Guest User

Untitled

a guest
Sep 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. use std::marker::PhantomData;
  2.  
  3. trait Class {
  4. type Parent;
  5. }
  6.  
  7. struct ObjectClass<S: ObjectScript>(PhantomData<S>)
  8. where
  9. S::Parent: ObjectChild;
  10.  
  11. trait ObjectChild {}
  12.  
  13. impl<S: ObjectScript> ObjectChild for ObjectClass<S>
  14. where
  15. S::Parent: ObjectChild {}
  16.  
  17. trait ObjectScript : Class
  18. where
  19. <Self as Class>::Parent: ObjectChild {}
  20.  
  21. struct Test;
  22.  
  23. impl Class for Test {
  24. type Parent = ObjectClass<Self>;
  25. }
  26. impl ObjectScript for Test {}
Add Comment
Please, Sign In to add comment