Guest User

Untitled

a guest
Mar 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. struct Foo;
  2.  
  3. struct FooFilter<'a> {
  4. foo: &'a Foo,
  5. }
  6.  
  7. trait Filter<'a> {
  8. type Output;
  9.  
  10. fn make_filter(&'a mut self) -> Self::Output;
  11. }
  12.  
  13. impl<'a> Filter<'a> for Foo {
  14. type Output = FooFilter<'a>;
  15.  
  16. fn make_filter(&'a mut self) -> Self::Output {
  17. FooFilter { foo: &*self }
  18. }
  19. }
  20.  
  21. pub trait Scan<Filter> {}
  22.  
  23. impl<'a> Scan<FooFilter<'a>> for Foo {}
  24.  
  25. trait Assert1<'a>
  26. where
  27. Self: Filter<'a>,
  28. Self: Scan<<Self as Filter<'a>>::Output>,
  29. {
  30. }
  31. impl<'a> Assert1<'a> for Foo {}
  32.  
  33. trait Assert2
  34. where
  35. for<'a> Self: Filter<'a>,
  36. Self: for<'a> Scan<<Self as Filter<'a>>::Output>,
  37. {
  38. }
  39. impl Assert2 for Foo {}
  40.  
  41. fn main() {}
Add Comment
Please, Sign In to add comment