Skip to content

Instantly share code, notes, and snippets.

@utaal
Last active June 4, 2016 18:31
Show Gist options
  • Save utaal/b9f306313ab118f387e3e429c54963ad to your computer and use it in GitHub Desktop.
Save utaal/b9f306313ab118f387e3e429c54963ad to your computer and use it in GitHub Desktop.
trait Logic<D> {
// ...
}
impl<D, F> Logic<D> for F where F: FnMut(D) {
// ...
}
// ...
impl<D> Container<D> {
// ...
fn foo<L: Logic<D>>(&self, logic: L) {
// ...
}
}
let c: Container<u64> = ...
c.foo(|val| println!(val))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment