Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Base {
- type Item;
- type Item2;
- }
- trait Service {
- type R;
- type E;
- type C: Base<Item = Self::R, Item2 = Self::E>;
- }
- fn create() -> impl Service {
- struct BaseImpl {}
- impl Base for BaseImpl {
- type Item = u64;
- type Item2 = String;
- }
- struct ServiceImpl {}
- impl Service for ServiceImpl {
- type R = u64;
- type E = String;
- type C = BaseImpl;
- }
- ServiceImpl {}
- }
- struct S1<T: Service> {
- service: T,
- }
- struct S2<T: Service> {
- s1: S1<T>,
- }
- fn main() {
- let s1 = S1 { service: create() };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement