Skip to content

Instantly share code, notes, and snippets.

@DreamLinuxer
Created September 5, 2019 19:51
Show Gist options
  • Save DreamLinuxer/d7e67053e2b8a480a0b34f6d90301513 to your computer and use it in GitHub Desktop.
Save DreamLinuxer/d7e67053e2b8a480a0b34f6d90301513 to your computer and use it in GitHub Desktop.
pub trait Encoding {
fn encode (b : bool) -> Self;
fn decode (&self) -> bool;
}
pub trait Comp : Encoding {
fn and(l:Self,r:Self) -> Self;
}
fn test<T : Comp> (l:T,r:T) -> T {
T::and(l,r)
}
fn main() {
}
pub trait Encoding {
fn encode (b : bool) -> Self;
fn decode (&self) -> bool;
}
pub trait Comp : Encoding {
fn and(l:Self,r:Self) -> Self;
}
fn test<T : Comp> (l:T,r:T) -> T {
T::and(l,r)
}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment