File: trait_in_mods.rs

package info (click to toggle)
rust-auto-impl 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 556 kB
  • sloc: makefile: 2; sh: 1
file content (69 lines) | stat: -rw-r--r-- 1,551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Make sure that everything compiles even without the prelude. This basically
// forces us to generate full paths for types of the standard/core library.
//
// Note that `no_implicit_prelude` attribute appears to interact strangely
// with Rust's 2018 style modules and extern crates.
#![no_implicit_prelude]

extern crate std;
extern crate auto_impl;


mod outer {
    use crate::{
        auto_impl::auto_impl,
        std::{
            string::String,
            result::Result,
        }
    };

    #[auto_impl(Fn)]
    trait Foo<'a, T> {
        fn execute<'b>(
            &'a self,
            arg1: &'b T,
            arg3: &'static str,
        ) -> Result<T, String>;
    }

    #[auto_impl(&, &mut, Box, Rc, Arc)]
    trait Bar<'a, T> {
        fn execute<'b>(
            &'a self,
            arg1: &'b T,
            arg3: &'static str,
        ) -> Result<T, String>;
    }

    mod inner {
        use crate::{
            auto_impl::auto_impl,
            std::{
                string::String,
                result::Result,
            }
        };

        #[auto_impl(Fn)]
        trait Foo<'a, T> {
            fn execute<'b>(
                &'a self,
                arg1: &'b T,
                arg3: &'static str,
            ) -> Result<T, String>;
        }

        #[auto_impl(&, &mut, Box, Rc, Arc)]
        trait Bar<'a, T> {
            fn execute<'b>(
                &'a self,
                arg1: &'b T,
                arg3: &'static str,
            ) -> Result<T, String>;
        }
    }
}


fn main() {}