Guest User

Untitled

a guest
May 26th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. trait MyTrait<I, O> {
  2. type MyType;
  3.  
  4. fn my_method(&self);
  5.  
  6. }
  7.  
  8. impl<F, I, O> MyTrait<I, O> for F
  9. where
  10. F: Fn(I) -> O,
  11. {
  12. type MyType = F::Output;
  13.  
  14. fn my_method(&self) {
  15. println!("hello my_method");
  16. }
  17.  
  18.  
  19. }
  20.  
  21. fn main() {
  22. (|_: &str| {4}).my_method();
  23. }
Add Comment
Please, Sign In to add comment