Created
March 19, 2016 04:21
-
-
Save anonymous/92329f1229a4d65d9751 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or 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 Schema { | |
fn eq(&self, other: &Schema) -> bool; | |
} | |
impl<'a> PartialEq<&'a Schema> for &'a Schema { | |
fn eq(&self, other: &&Schema) -> bool { | |
Schema::eq(*self, *other) | |
} | |
} | |
struct Foo; | |
impl Schema for Foo { | |
fn eq(&self, _other: &Schema) -> bool { true } | |
} | |
fn main() { | |
let foo1 = Foo; | |
let foo2 = Foo; | |
if &foo1 as &Schema == &foo2 as &Schema { | |
println!("Hello, world!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment