Debian Codegraph @

src/types/mut.rs

raw symbols SCIP
1 use synrust-analyzer cargo syn 2.0.119 crate/::parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/;
2
3 use craterust-analyzer cargo blanket 0.4.0 crate/::deriverust-analyzer cargo blanket 0.4.0 derive/::Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#;
4 use craterust-analyzer cargo blanket 0.4.0 crate/::deriverust-analyzer cargo blanket 0.4.0 derive/::WrapperTyperust-analyzer cargo blanket 0.4.0 derive/WrapperType#;
5
6 struct MutTyperust-analyzer cargo blanket 0.4.0 types/`r#mut`/MutType#;
7
8 impl WrapperTyperust-analyzer cargo blanket 0.4.0 derive/WrapperType# for MutTyperust-analyzer cargo blanket 0.4.0 types/`r#mut`/MutType# {
9 const NAMErust-analyzer cargo blanket 0.4.0 types/`r#mut`/impl#[MutType][WrapperType]NAME.: &'static str = "Mut";
10 const RECEIVERSrust-analyzer cargo blanket 0.4.0 types/`r#mut`/impl#[MutType][WrapperType]RECEIVERS.: &'static [Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#] = &[Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#::Refrust-analyzer cargo blanket 0.4.0 derive/Receiver#Ref#, Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#::Mutrust-analyzer cargo blanket 0.4.0 derive/Receiver#Mut#];
11 fn wraprust-analyzer cargo blanket 0.4.0 types/`r#mut`/impl#[MutType][WrapperType]wrap().(ty: &synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Typerust-analyzer cargo syn 2.0.119 ty/Type# {
12 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(&mut #ty)
13 }
14 }
15
16 pub fn deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(trait_: &synrust-analyzer cargo syn 2.0.119 crate/::ItemTraitrust-analyzer cargo syn 2.0.119 item/ItemTrait#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<synrust-analyzer cargo syn 2.0.119 crate/::ItemImplrust-analyzer cargo syn 2.0.119 item/ItemImpl#> {
17 MutTyperust-analyzer cargo blanket 0.4.0 types/`r#mut`/MutType#::deriverust-analyzer cargo blanket 0.4.0 derive/WrapperType#derive().(trait_)
18 }
19
20 #[cfg(test)]
21 mod testsrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/ {
22 mod deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/ {
23
24 use synrust-analyzer cargo syn 2.0.119 crate/::parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/;
25
26 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
27 fn emptyrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/empty().() {
28 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
29 trait MyTrait {}
30 );
31 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
32 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
33 derived,
34 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
35 #[automatically_derived]
36 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {}
37 )
38 );
39 }
40
41 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
42 fn receiver_mutrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/receiver_mut().() {
43 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
44 trait MyTrait {
45 fn my_method(&mut self);
46 }
47 );
48 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
49 superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
50 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
51 #[automatically_derived]
52 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
53 #[inline]
54 fn my_method(&mut self) {
55 (*(*self)).my_method()
56 }
57 }
58 )
59 );
60 }
61
62 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
63 fn receiver_selfrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/receiver_self().() {
64 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
65 trait MyTrait {
66 fn my_method(self);
67 }
68 );
69 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
70 }
71
72 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
73 fn receiver_arbitraryrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/receiver_arbitrary().() {
74 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
75 trait MyTrait {
76 fn my_method(self: Box<Self>);
77 }
78 );
79 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
80 }
81
82 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
83 fn genericsrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/generics().() {
84 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
85 trait Trait<T> {}
86 );
87 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
88
89 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
90 derived,
91 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
92 #[automatically_derived]
93 impl<T, T_: Trait<T> + ?Sized> Trait<T> for &mut T_ {}
94 )
95 );
96 }
97
98 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
99 fn generics_boundedrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/generics_bounded().() {
100 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
101 trait Trait<T: 'static + Send> {}
102 );
103 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
104
105 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
106 derived,
107 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
108 #[automatically_derived]
109 impl<T: 'static + Send, T_: Trait<T> + ?Sized> Trait<T> for &mut T_ {}
110 )
111 );
112 }
113
114 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
115 fn generics_lifetimerust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/generics_lifetime().() {
116 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
117 trait Trait<'a, 'b: 'a, T: 'static + Send> {}
118 );
119 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
120
121 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
122 derived,
123 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
124 #[automatically_derived]
125 impl<'a, 'b: 'a, T: 'static + Send, T_: Trait<'a, 'b, T> + ?Sized>
126 Trait<'a, 'b, T> for &mut T_
127 {
128 }
129 )
130 );
131 }
132
133 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
134 fn associated_typesrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_types().() {
135 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
136 trait MyTrait {
137 type Return;
138 }
139 );
140 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
141
142 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
143 derived,
144 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
145 #[automatically_derived]
146 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
147 type Return = <MT as MyTrait>::Return;
148 }
149 )
150 );
151 }
152
153 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
154 fn associated_types_boundrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_types_bound().() {
155 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
156 trait MyTrait {
157 type Return: Clone;
158 }
159 );
160 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
161
162 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
163 derived,
164 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
165 #[automatically_derived]
166 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
167 type Return = <MT as MyTrait>::Return;
168 }
169 )
170 );
171 }
172
173 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
174 fn associated_types_dodgy_namerust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_types_dodgy_name().() {
175 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
176 trait MyTrait {
177 type r#type;
178 }
179 );
180 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
181
182 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
183 derived,
184 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
185 #[automatically_derived]
186 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
187 type r#type = <MT as MyTrait>::r#type;
188 }
189 )
190 );
191 }
192
193 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
194 fn associated_types_attrsrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_types_attrs().() {
195 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
196 trait MyTrait {
197 #[cfg(target_arch = "wasm32")]
198 type Return;
199 #[cfg(not(target_arch = "wasm32"))]
200 type Return: Send;
201 }
202 );
203 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
204
205 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
206 derived,
207 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
208 #[automatically_derived]
209 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
210 #[cfg(target_arch = "wasm32")]
211 type Return = <MT as MyTrait>::Return;
212 #[cfg(not(target_arch = "wasm32"))]
213 type Return = <MT as MyTrait>::Return;
214 }
215 )
216 );
217 }
218
219 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
220 fn associated_types_and_genericsrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_types_and_generics().() {
221 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
222 trait MyTrait<T> {
223 type Return;
224 }
225 );
226 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
227
228 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
229 derived,
230 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
231 #[automatically_derived]
232 impl<T, MT: MyTrait<T> + ?Sized> MyTrait<T> for &mut MT {
233 type Return = <MT as MyTrait<T>>::Return;
234 }
235 )
236 );
237 }
238
239 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
240 fn associated_type_genericsrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_type_generics().() {
241 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
242 trait MyTrait {
243 type Return<T>;
244 }
245 );
246 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
247
248 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
249 derived,
250 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
251 #[automatically_derived]
252 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
253 type Return<T> = <MT as MyTrait>::Return<T>;
254 }
255 )
256 );
257 }
258
259 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
260 fn associated_type_generics_boundedrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_type_generics_bounded().() {
261 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
262 trait MyTrait {
263 type Return<T: 'static + Send>;
264 }
265 );
266 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
267
268 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
269 derived,
270 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
271 #[automatically_derived]
272 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
273 type Return<T: 'static + Send> = <MT as MyTrait>::Return<T>;
274 }
275 )
276 );
277 }
278
279 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
280 fn associated_type_generics_lifetimesrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/derive/associated_type_generics_lifetimes().() {
281 let trait_ = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
282 trait MyTrait {
283 type Return<'a>
284 where
285 Self: 'a;
286 }
287 );
288 let derived = superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/tests/::superrust-analyzer cargo blanket 0.4.0 types/`r#mut`/::deriverust-analyzer cargo blanket 0.4.0 types/`r#mut`/derive().(&trait_).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
289
290 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
291 derived,
292 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(
293 #[automatically_derived]
294 impl<MT: MyTrait + ?Sized> MyTrait for &mut MT {
295 type Return<'a> = <MT as MyTrait>::Return<'a>
296 where
297 Self: 'a;
298 }
299 )
300 );
301 }
302 }
303 }