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 {}
- }
- fn create_config() -> impl Service {
- let mut srv = create();
- srv
- }
- struct S1<T: Service> {
- service: T,
- }
- fn new_service() -> S1<impl Service> {
- S1 {
- service: create_config(),
- }
- }
- impl<S: Service> S1<S> {
- fn new() -> S1<impl Service> {
- S1 {
- service: create_config(),
- }
- }
- }
- fn main() {
- //let s = S1::new();
- let s = new_service();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement