Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. trait Base {
  2. type Item;
  3. type Item2;
  4. }
  5.  
  6. trait Service {
  7. type R;
  8. type E;
  9. type C: Base<Item = Self::R, Item2 = Self::E>;
  10. }
  11.  
  12. struct Inner<T: Service> {
  13. service: T,
  14. }
  15.  
  16. struct S1<T: Service> {
  17. inner: Inner<T>,
  18. }
  19.  
  20. struct S2 {
  21. inner: Inner<ServiceImpl>,
  22. }
  23.  
  24. struct BaseImpl {}
  25. impl Base for BaseImpl {
  26. type Item = u64;
  27. type Item2 = String;
  28. }
  29.  
  30. struct ServiceImpl {}
  31. impl Service for ServiceImpl {
  32. type R = u64;
  33. type E = String;
  34. type C = BaseImpl;
  35. }
  36.  
  37. fn create() -> ServiceImpl { // хз что тут должно быть
  38. panic!()
  39. }
  40.  
  41. fn main() {
  42. let a = S2 { inner: create() };
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement