Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. trait Foo {}
  2. trait Baz : Foo {
  3. fn baz();
  4. }
  5.  
  6. struct A;
  7. struct B;
  8. struct C;
  9.  
  10. impl Foo for A {}
  11. impl Foo for B {}
  12. impl Foo for C {}
  13.  
  14. impl Baz for A {
  15. fn baz() {}
  16. }
  17. impl Baz for B {
  18. fn baz() {}
  19. }
  20.  
  21. struct PlatformDependent<F: Foo>(F);
  22.  
  23. impl<F: Baz> PlatformDependent<F>
  24. where
  25. {
  26. fn bar() {
  27. F::baz();
  28. }
  29. }
  30.  
  31. /* No implementation for Platform C */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement