Last active
December 12, 2017 19:57
-
-
Save skade/53e4afb98786739ef2cdba3195e62e18 to your computer and use it in GitHub Desktop.
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::fmt::Debug; | |
fn wrap<A, B>(item: A, f: fn(A) -> B) -> B { | |
f(item) | |
} | |
fn main() { | |
println!("{:?}", wrap(1, Hoge::Fuga)); | |
println!("{:?}", wrap(1, Foo::Bar)); | |
} | |
#[derive(Debug)] | |
enum Hoge<T> | |
where | |
T: Debug, | |
{ | |
Fuga(T), | |
Piyo(T), | |
} | |
#[derive(Debug)] | |
enum Foo<T> | |
where | |
T: Debug, | |
{ | |
Bar(T), | |
Batz(T), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment