Skip to content

Instantly share code, notes, and snippets.

@skade skade/gnihihi.rs
Last active Dec 12, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.