Guest User

Untitled

a guest
Apr 26th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. pub trait RestrictiveFn: Fn(&mut i32) + Send + Sync + 'static { }
  2. impl<T> RestrictiveFn for T where T: Fn(&mut i32) + Send + Sync + 'static { }
  3.  
  4. struct Fine {
  5. member: Box<Fn(&mut i32) + Send + Sync + 'static>,
  6. }
  7.  
  8. struct Confusing {
  9. member: Box<RestrictiveFn>,
  10. }
  11.  
  12. struct VerboseButOk {
  13. member: Box<RestrictiveFn<Output=()>>,
  14. }
  15.  
  16. pub trait ReturnDoesNotHelp: Fn(&mut i32) -> () + Send + Sync + 'static { }
  17. impl<T> ReturnDoesNotHelp for T where T: Fn(&mut i32) -> () + Send + Sync + 'static { }
  18.  
  19. struct ConfusingAgain {
  20. member: Box<ReturnDoesNotHelp>,
  21. }
  22.  
  23.  
  24. fn main() { }
Add Comment
Please, Sign In to add comment