Created
August 10, 2016 06:48
-
-
Save Sgeo/3fd554338218abb0c5954cd681008870 to your computer and use it in GitHub Desktop.
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
#![feature(specialization)] | |
struct Foo; | |
struct No; | |
struct Yes; | |
trait Bar { | |
type Result; | |
} | |
impl<T> Bar for T { | |
default type Result = No; | |
} | |
impl Bar for Foo { | |
type Result = Yes; | |
} | |
trait Baz { | |
fn foo(&self) { | |
println!("Hi"); | |
} | |
} | |
impl<T: Bar<Result=Yes>> Baz for T {} | |
fn main() { | |
Foo.foo(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment