This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Apply { | |
type Out; | |
} | |
trait Unapply { | |
type Out; | |
} | |
type Applied<F, T> = <(F, T) as Apply>::Out; | |
type Unapplied<T> = <T as Unapply>::Out; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This trait is not used, but is useful for type equality constraints | |
trait ID { | |
type Out; | |
} | |
impl<T> ID for T { | |
type Out = T; | |
} | |
trait CanApply { | |
type Out: CanUnapply; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This trait is not used, but is useful for type equality constraints | |
trait ID { | |
type Out; | |
} | |
impl<T> ID for T { | |
type Out = T; | |
} | |
trait CanApply { | |
type Out: CanUnapply; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(optin_builtin_traits)] | |
use std::marker::PhantomData; | |
struct Nil; | |
struct Cons<H, T>(H, T); | |
struct Zero; | |
struct One; | |
trait UInt { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(optin_builtin_traits)] | |
use std::marker::PhantomData; | |
struct Nil; | |
struct Cons<H, T>(H, T); | |
struct Pair<A, B>(A, B); | |
trait Lookup_<S, Env> { type Type; } | |
type Lookup<S, Env> = <() as Lookup_<S, Env>>::Type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(optin_builtin_traits)] | |
use std::marker::PhantomData; | |
struct Nil; | |
struct Cons<H, T>(H, T); | |
struct Pair<A, B>(A, B); | |
trait Lookup_<S, Env> { type Type; } | |
type Lookup<S, Env> = <() as Lookup_<S, Env>>::Type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(optin_builtin_traits)] | |
use std::marker::PhantomData; | |
trait Lookup<K> { | |
type V; | |
fn get(&self) -> &Self::V; | |
} | |
struct Nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(optin_builtin_traits)] | |
use std::marker::PhantomData; | |
trait Lookup<K> { | |
type V; | |
fn get(&self) -> &Self::V; | |
} | |
struct Nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
use std::marker::PhantomData; | |
use std::collections::hash_map; | |
pub trait DiffableIters<'a, T: Diffable> where T::Key: 'a, T::ListChild: 'a { | |
type KeyIter: Iterator<Item=&'a T::Key>; | |
type ListChildIter: Iterator<Item=&'a T::ListChild>; | |
} | |
pub type KeyIter<'a, T> = <T as DiffableIters<'a, T>>::KeyIter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::Any; | |
use std::rc::Rc; | |
trait AsAny { | |
fn as_any(&self) -> &Any; | |
} | |
impl<T: Any> AsAny for T { | |
fn as_any(&self) -> &Any { self } | |
} |
OlderNewer