1#![cfg_attr(rustfmt, rustfmt::skip)]
7#![allow(unused_parens)]
8#![allow(
9 clippy::double_parens,
10 clippy::just_underscores_and_digits,
11 clippy::match_single_binding,
12)]
13use crate::*;
14syn_trait_impl!(syn::Abi);
15impl From<&syn::Abi> for Abi {
16 fn from(node: &syn::Abi) -> Self {
17 Self { name: node.name.map_into() }
18 }
19}
20impl From<&Abi> for syn::Abi {
21 fn from(node: &Abi) -> Self {
22 Self {
23 extern_token: default(),
24 name: node.name.map_into(),
25 }
26 }
27}
28syn_trait_impl!(syn::AngleBracketedGenericArguments);
29impl From<&syn::AngleBracketedGenericArguments> for AngleBracketedGenericArguments {
30 fn from(node: &syn::AngleBracketedGenericArguments) -> Self {
31 Self {
32 colon2_token: node.colon2_token.is_some(),
33 args: node.args.map_into(),
34 }
35 }
36}
37impl From<&AngleBracketedGenericArguments> for syn::AngleBracketedGenericArguments {
38 fn from(node: &AngleBracketedGenericArguments) -> Self {
39 Self {
40 colon2_token: default_or_none(node.colon2_token),
41 lt_token: default(),
42 args: node.args.map_into(),
43 gt_token: default(),
44 }
45 }
46}
47syn_trait_impl!(syn::AssocConst);
48impl From<&syn::AssocConst> for AssocConst {
49 fn from(node: &syn::AssocConst) -> Self {
50 Self {
51 ident: node.ident.ref_into(),
52 generics: node.generics.map_into(),
53 value: node.value.ref_into(),
54 }
55 }
56}
57impl From<&AssocConst> for syn::AssocConst {
58 fn from(node: &AssocConst) -> Self {
59 Self {
60 ident: node.ident.ref_into(),
61 generics: node.generics.map_into(),
62 eq_token: default(),
63 value: node.value.ref_into(),
64 }
65 }
66}
67syn_trait_impl!(syn::AssocType);
68impl From<&syn::AssocType> for AssocType {
69 fn from(node: &syn::AssocType) -> Self {
70 Self {
71 ident: node.ident.ref_into(),
72 generics: node.generics.map_into(),
73 ty: node.ty.ref_into(),
74 }
75 }
76}
77impl From<&AssocType> for syn::AssocType {
78 fn from(node: &AssocType) -> Self {
79 Self {
80 ident: node.ident.ref_into(),
81 generics: node.generics.map_into(),
82 eq_token: default(),
83 ty: node.ty.ref_into(),
84 }
85 }
86}
87syn_trait_impl!(syn::AttrStyle);
88impl From<&syn::AttrStyle> for AttrStyle {
89 fn from(node: &syn::AttrStyle) -> Self {
90 match node {
91 syn::AttrStyle::Outer => AttrStyle::Outer,
92 syn::AttrStyle::Inner(..) => AttrStyle::Inner,
93 }
94 }
95}
96impl From<&AttrStyle> for syn::AttrStyle {
97 fn from(node: &AttrStyle) -> Self {
98 match node {
99 AttrStyle::Outer => syn::AttrStyle::Outer,
100 AttrStyle::Inner => syn::AttrStyle::Inner(default()),
101 }
102 }
103}
104syn_trait_impl!(syn::Attribute);
105impl From<&syn::Attribute> for Attribute {
106 fn from(node: &syn::Attribute) -> Self {
107 Self {
108 style: node.style.ref_into(),
109 meta: node.meta.ref_into(),
110 }
111 }
112}
113impl From<&Attribute> for syn::Attribute {
114 fn from(node: &Attribute) -> Self {
115 Self {
116 pound_token: default(),
117 style: node.style.ref_into(),
118 bracket_token: default(),
119 meta: node.meta.ref_into(),
120 }
121 }
122}
123syn_trait_impl!(syn::BareFnArg);
124impl From<&syn::BareFnArg> for BareFnArg {
125 fn from(node: &syn::BareFnArg) -> Self {
126 Self {
127 attrs: node.attrs.map_into(),
128 name: node.name.ref_map(|(_0, _1)| (*_0).ref_into()),
129 ty: node.ty.ref_into(),
130 }
131 }
132}
133impl From<&BareFnArg> for syn::BareFnArg {
134 fn from(node: &BareFnArg) -> Self {
135 Self {
136 attrs: node.attrs.map_into(),
137 name: node.name.ref_map(|_0| ((*_0).ref_into(), default())),
138 ty: node.ty.ref_into(),
139 }
140 }
141}
142syn_trait_impl!(syn::BareVariadic);
143impl From<&syn::BareVariadic> for BareVariadic {
144 fn from(node: &syn::BareVariadic) -> Self {
145 Self {
146 attrs: node.attrs.map_into(),
147 name: node.name.ref_map(|(_0, _1)| (*_0).ref_into()),
148 comma: node.comma.is_some(),
149 }
150 }
151}
152impl From<&BareVariadic> for syn::BareVariadic {
153 fn from(node: &BareVariadic) -> Self {
154 Self {
155 attrs: node.attrs.map_into(),
156 name: node.name.ref_map(|_0| ((*_0).ref_into(), default())),
157 dots: default(),
158 comma: default_or_none(node.comma),
159 }
160 }
161}
162syn_trait_impl!(syn::BinOp);
163impl From<&syn::BinOp> for BinOp {
164 fn from(node: &syn::BinOp) -> Self {
165 match node {
166 syn::BinOp::Add(..) => BinOp::Add,
167 syn::BinOp::Sub(..) => BinOp::Sub,
168 syn::BinOp::Mul(..) => BinOp::Mul,
169 syn::BinOp::Div(..) => BinOp::Div,
170 syn::BinOp::Rem(..) => BinOp::Rem,
171 syn::BinOp::And(..) => BinOp::And,
172 syn::BinOp::Or(..) => BinOp::Or,
173 syn::BinOp::BitXor(..) => BinOp::BitXor,
174 syn::BinOp::BitAnd(..) => BinOp::BitAnd,
175 syn::BinOp::BitOr(..) => BinOp::BitOr,
176 syn::BinOp::Shl(..) => BinOp::Shl,
177 syn::BinOp::Shr(..) => BinOp::Shr,
178 syn::BinOp::Eq(..) => BinOp::Eq,
179 syn::BinOp::Lt(..) => BinOp::Lt,
180 syn::BinOp::Le(..) => BinOp::Le,
181 syn::BinOp::Ne(..) => BinOp::Ne,
182 syn::BinOp::Ge(..) => BinOp::Ge,
183 syn::BinOp::Gt(..) => BinOp::Gt,
184 syn::BinOp::AddAssign(..) => BinOp::AddAssign,
185 syn::BinOp::SubAssign(..) => BinOp::SubAssign,
186 syn::BinOp::MulAssign(..) => BinOp::MulAssign,
187 syn::BinOp::DivAssign(..) => BinOp::DivAssign,
188 syn::BinOp::RemAssign(..) => BinOp::RemAssign,
189 syn::BinOp::BitXorAssign(..) => BinOp::BitXorAssign,
190 syn::BinOp::BitAndAssign(..) => BinOp::BitAndAssign,
191 syn::BinOp::BitOrAssign(..) => BinOp::BitOrAssign,
192 syn::BinOp::ShlAssign(..) => BinOp::ShlAssign,
193 syn::BinOp::ShrAssign(..) => BinOp::ShrAssign,
194 _ => unreachable!(),
195 }
196 }
197}
198impl From<&BinOp> for syn::BinOp {
199 fn from(node: &BinOp) -> Self {
200 match node {
201 BinOp::Add => syn::BinOp::Add(default()),
202 BinOp::Sub => syn::BinOp::Sub(default()),
203 BinOp::Mul => syn::BinOp::Mul(default()),
204 BinOp::Div => syn::BinOp::Div(default()),
205 BinOp::Rem => syn::BinOp::Rem(default()),
206 BinOp::And => syn::BinOp::And(default()),
207 BinOp::Or => syn::BinOp::Or(default()),
208 BinOp::BitXor => syn::BinOp::BitXor(default()),
209 BinOp::BitAnd => syn::BinOp::BitAnd(default()),
210 BinOp::BitOr => syn::BinOp::BitOr(default()),
211 BinOp::Shl => syn::BinOp::Shl(default()),
212 BinOp::Shr => syn::BinOp::Shr(default()),
213 BinOp::Eq => syn::BinOp::Eq(default()),
214 BinOp::Lt => syn::BinOp::Lt(default()),
215 BinOp::Le => syn::BinOp::Le(default()),
216 BinOp::Ne => syn::BinOp::Ne(default()),
217 BinOp::Ge => syn::BinOp::Ge(default()),
218 BinOp::Gt => syn::BinOp::Gt(default()),
219 BinOp::AddAssign => syn::BinOp::AddAssign(default()),
220 BinOp::SubAssign => syn::BinOp::SubAssign(default()),
221 BinOp::MulAssign => syn::BinOp::MulAssign(default()),
222 BinOp::DivAssign => syn::BinOp::DivAssign(default()),
223 BinOp::RemAssign => syn::BinOp::RemAssign(default()),
224 BinOp::BitXorAssign => syn::BinOp::BitXorAssign(default()),
225 BinOp::BitAndAssign => syn::BinOp::BitAndAssign(default()),
226 BinOp::BitOrAssign => syn::BinOp::BitOrAssign(default()),
227 BinOp::ShlAssign => syn::BinOp::ShlAssign(default()),
228 BinOp::ShrAssign => syn::BinOp::ShrAssign(default()),
229 }
230 }
231}
232syn_trait_impl!(syn::Block);
233impl From<&syn::Block> for Block {
234 fn from(node: &syn::Block) -> Self {
235 Self {
236 stmts: node.stmts.map_into(),
237 }
238 }
239}
240impl From<&Block> for syn::Block {
241 fn from(node: &Block) -> Self {
242 Self {
243 brace_token: default(),
244 stmts: node.stmts.map_into(),
245 }
246 }
247}
248syn_trait_impl!(syn::BoundLifetimes);
249impl From<&syn::BoundLifetimes> for BoundLifetimes {
250 fn from(node: &syn::BoundLifetimes) -> Self {
251 Self {
252 lifetimes: node.lifetimes.map_into(),
253 }
254 }
255}
256impl From<&BoundLifetimes> for syn::BoundLifetimes {
257 fn from(node: &BoundLifetimes) -> Self {
258 Self {
259 for_token: default(),
260 lt_token: default(),
261 lifetimes: node.lifetimes.map_into(),
262 gt_token: default(),
263 }
264 }
265}
266syn_trait_impl!(syn::ConstParam);
267impl From<&syn::ConstParam> for ConstParam {
268 fn from(node: &syn::ConstParam) -> Self {
269 Self {
270 attrs: node.attrs.map_into(),
271 ident: node.ident.ref_into(),
272 ty: node.ty.ref_into(),
273 eq_token: node.eq_token.is_some(),
274 default: node.default.map_into(),
275 }
276 }
277}
278impl From<&ConstParam> for syn::ConstParam {
279 fn from(node: &ConstParam) -> Self {
280 Self {
281 attrs: node.attrs.map_into(),
282 const_token: default(),
283 ident: node.ident.ref_into(),
284 colon_token: default(),
285 ty: node.ty.ref_into(),
286 eq_token: default_or_none(node.eq_token),
287 default: node.default.map_into(),
288 }
289 }
290}
291syn_trait_impl!(syn::Constraint);
292impl From<&syn::Constraint> for Constraint {
293 fn from(node: &syn::Constraint) -> Self {
294 Self {
295 ident: node.ident.ref_into(),
296 generics: node.generics.map_into(),
297 bounds: node.bounds.map_into(),
298 }
299 }
300}
301impl From<&Constraint> for syn::Constraint {
302 fn from(node: &Constraint) -> Self {
303 Self {
304 ident: node.ident.ref_into(),
305 generics: node.generics.map_into(),
306 colon_token: default(),
307 bounds: node.bounds.map_into(),
308 }
309 }
310}
311syn_trait_impl!(syn::Expr);
312impl From<&syn::Expr> for Expr {
313 fn from(node: &syn::Expr) -> Self {
314 match node {
315 syn::Expr::Array(_0) => Expr::Array((*_0).ref_into()),
316 syn::Expr::Assign(_0) => Expr::Assign((*_0).ref_into()),
317 syn::Expr::Async(_0) => Expr::Async((*_0).ref_into()),
318 syn::Expr::Await(_0) => Expr::Await((*_0).ref_into()),
319 syn::Expr::Binary(_0) => Expr::Binary((*_0).ref_into()),
320 syn::Expr::Block(_0) => Expr::Block((*_0).ref_into()),
321 syn::Expr::Break(_0) => Expr::Break((*_0).ref_into()),
322 syn::Expr::Call(_0) => Expr::Call((*_0).ref_into()),
323 syn::Expr::Cast(_0) => Expr::Cast((*_0).ref_into()),
324 syn::Expr::Closure(_0) => Expr::Closure((*_0).ref_into()),
325 syn::Expr::Const(_0) => Expr::Const((*_0).ref_into()),
326 syn::Expr::Continue(_0) => Expr::Continue((*_0).ref_into()),
327 syn::Expr::Field(_0) => Expr::Field((*_0).ref_into()),
328 syn::Expr::ForLoop(_0) => Expr::ForLoop((*_0).ref_into()),
329 syn::Expr::Group(_0) => Expr::Group((*_0).ref_into()),
330 syn::Expr::If(_0) => Expr::If((*_0).ref_into()),
331 syn::Expr::Index(_0) => Expr::Index((*_0).ref_into()),
332 syn::Expr::Infer(_0) => Expr::Infer((*_0).ref_into()),
333 syn::Expr::Let(_0) => Expr::Let((*_0).ref_into()),
334 syn::Expr::Lit(_0) => Expr::Lit((*_0).ref_into()),
335 syn::Expr::Loop(_0) => Expr::Loop((*_0).ref_into()),
336 syn::Expr::Macro(_0) => Expr::Macro((*_0).ref_into()),
337 syn::Expr::Match(_0) => Expr::Match((*_0).ref_into()),
338 syn::Expr::MethodCall(_0) => Expr::MethodCall((*_0).ref_into()),
339 syn::Expr::Paren(_0) => Expr::Paren((*_0).ref_into()),
340 syn::Expr::Path(_0) => Expr::Path((*_0).ref_into()),
341 syn::Expr::Range(_0) => Expr::Range((*_0).ref_into()),
342 syn::Expr::Reference(_0) => Expr::Reference((*_0).ref_into()),
343 syn::Expr::Repeat(_0) => Expr::Repeat((*_0).ref_into()),
344 syn::Expr::Return(_0) => Expr::Return((*_0).ref_into()),
345 syn::Expr::Struct(_0) => Expr::Struct((*_0).ref_into()),
346 syn::Expr::Try(_0) => Expr::Try((*_0).ref_into()),
347 syn::Expr::TryBlock(_0) => Expr::TryBlock((*_0).ref_into()),
348 syn::Expr::Tuple(_0) => Expr::Tuple((*_0).ref_into()),
349 syn::Expr::Unary(_0) => Expr::Unary((*_0).ref_into()),
350 syn::Expr::Unsafe(_0) => Expr::Unsafe((*_0).ref_into()),
351 syn::Expr::Verbatim(_0) => Expr::Verbatim((*_0).ref_into()),
352 syn::Expr::While(_0) => Expr::While((*_0).ref_into()),
353 syn::Expr::Yield(_0) => Expr::Yield((*_0).ref_into()),
354 _ => unreachable!(),
355 }
356 }
357}
358impl From<&Expr> for syn::Expr {
359 fn from(node: &Expr) -> Self {
360 match node {
361 Expr::Array(_0) => syn::Expr::Array((*_0).ref_into()),
362 Expr::Assign(_0) => syn::Expr::Assign((*_0).ref_into()),
363 Expr::Async(_0) => syn::Expr::Async((*_0).ref_into()),
364 Expr::Await(_0) => syn::Expr::Await((*_0).ref_into()),
365 Expr::Binary(_0) => syn::Expr::Binary((*_0).ref_into()),
366 Expr::Block(_0) => syn::Expr::Block((*_0).ref_into()),
367 Expr::Break(_0) => syn::Expr::Break((*_0).ref_into()),
368 Expr::Call(_0) => syn::Expr::Call((*_0).ref_into()),
369 Expr::Cast(_0) => syn::Expr::Cast((*_0).ref_into()),
370 Expr::Closure(_0) => syn::Expr::Closure((*_0).ref_into()),
371 Expr::Const(_0) => syn::Expr::Const((*_0).ref_into()),
372 Expr::Continue(_0) => syn::Expr::Continue((*_0).ref_into()),
373 Expr::Field(_0) => syn::Expr::Field((*_0).ref_into()),
374 Expr::ForLoop(_0) => syn::Expr::ForLoop((*_0).ref_into()),
375 Expr::Group(_0) => syn::Expr::Group((*_0).ref_into()),
376 Expr::If(_0) => syn::Expr::If((*_0).ref_into()),
377 Expr::Index(_0) => syn::Expr::Index((*_0).ref_into()),
378 Expr::Infer(_0) => syn::Expr::Infer((*_0).ref_into()),
379 Expr::Let(_0) => syn::Expr::Let((*_0).ref_into()),
380 Expr::Lit(_0) => syn::Expr::Lit((*_0).ref_into()),
381 Expr::Loop(_0) => syn::Expr::Loop((*_0).ref_into()),
382 Expr::Macro(_0) => syn::Expr::Macro((*_0).ref_into()),
383 Expr::Match(_0) => syn::Expr::Match((*_0).ref_into()),
384 Expr::MethodCall(_0) => syn::Expr::MethodCall((*_0).ref_into()),
385 Expr::Paren(_0) => syn::Expr::Paren((*_0).ref_into()),
386 Expr::Path(_0) => syn::Expr::Path((*_0).ref_into()),
387 Expr::Range(_0) => syn::Expr::Range((*_0).ref_into()),
388 Expr::Reference(_0) => syn::Expr::Reference((*_0).ref_into()),
389 Expr::Repeat(_0) => syn::Expr::Repeat((*_0).ref_into()),
390 Expr::Return(_0) => syn::Expr::Return((*_0).ref_into()),
391 Expr::Struct(_0) => syn::Expr::Struct((*_0).ref_into()),
392 Expr::Try(_0) => syn::Expr::Try((*_0).ref_into()),
393 Expr::TryBlock(_0) => syn::Expr::TryBlock((*_0).ref_into()),
394 Expr::Tuple(_0) => syn::Expr::Tuple((*_0).ref_into()),
395 Expr::Unary(_0) => syn::Expr::Unary((*_0).ref_into()),
396 Expr::Unsafe(_0) => syn::Expr::Unsafe((*_0).ref_into()),
397 Expr::Verbatim(_0) => syn::Expr::Verbatim((*_0).ref_into()),
398 Expr::While(_0) => syn::Expr::While((*_0).ref_into()),
399 Expr::Yield(_0) => syn::Expr::Yield((*_0).ref_into()),
400 }
401 }
402}
403syn_trait_impl!(syn::ExprArray);
404impl From<&syn::ExprArray> for ExprArray {
405 fn from(node: &syn::ExprArray) -> Self {
406 Self {
407 attrs: node.attrs.map_into(),
408 elems: node.elems.map_into(),
409 }
410 }
411}
412impl From<&ExprArray> for syn::ExprArray {
413 fn from(node: &ExprArray) -> Self {
414 Self {
415 attrs: node.attrs.map_into(),
416 bracket_token: default(),
417 elems: node.elems.map_into(),
418 }
419 }
420}
421syn_trait_impl!(syn::ExprAssign);
422impl From<&syn::ExprAssign> for ExprAssign {
423 fn from(node: &syn::ExprAssign) -> Self {
424 Self {
425 attrs: node.attrs.map_into(),
426 left: node.left.map_into(),
427 right: node.right.map_into(),
428 }
429 }
430}
431impl From<&ExprAssign> for syn::ExprAssign {
432 fn from(node: &ExprAssign) -> Self {
433 Self {
434 attrs: node.attrs.map_into(),
435 left: node.left.map_into(),
436 eq_token: default(),
437 right: node.right.map_into(),
438 }
439 }
440}
441syn_trait_impl!(syn::ExprAsync);
442impl From<&syn::ExprAsync> for ExprAsync {
443 fn from(node: &syn::ExprAsync) -> Self {
444 Self {
445 attrs: node.attrs.map_into(),
446 capture: node.capture.is_some(),
447 block: node.block.ref_into(),
448 }
449 }
450}
451impl From<&ExprAsync> for syn::ExprAsync {
452 fn from(node: &ExprAsync) -> Self {
453 Self {
454 attrs: node.attrs.map_into(),
455 async_token: default(),
456 capture: default_or_none(node.capture),
457 block: node.block.ref_into(),
458 }
459 }
460}
461syn_trait_impl!(syn::ExprAwait);
462impl From<&syn::ExprAwait> for ExprAwait {
463 fn from(node: &syn::ExprAwait) -> Self {
464 Self {
465 attrs: node.attrs.map_into(),
466 base: node.base.map_into(),
467 }
468 }
469}
470impl From<&ExprAwait> for syn::ExprAwait {
471 fn from(node: &ExprAwait) -> Self {
472 Self {
473 attrs: node.attrs.map_into(),
474 base: node.base.map_into(),
475 dot_token: default(),
476 await_token: default(),
477 }
478 }
479}
480syn_trait_impl!(syn::ExprBinary);
481impl From<&syn::ExprBinary> for ExprBinary {
482 fn from(node: &syn::ExprBinary) -> Self {
483 Self {
484 attrs: node.attrs.map_into(),
485 left: node.left.map_into(),
486 op: node.op.ref_into(),
487 right: node.right.map_into(),
488 }
489 }
490}
491impl From<&ExprBinary> for syn::ExprBinary {
492 fn from(node: &ExprBinary) -> Self {
493 Self {
494 attrs: node.attrs.map_into(),
495 left: node.left.map_into(),
496 op: node.op.ref_into(),
497 right: node.right.map_into(),
498 }
499 }
500}
501syn_trait_impl!(syn::ExprBlock);
502impl From<&syn::ExprBlock> for ExprBlock {
503 fn from(node: &syn::ExprBlock) -> Self {
504 Self {
505 attrs: node.attrs.map_into(),
506 label: node.label.map_into(),
507 block: node.block.ref_into(),
508 }
509 }
510}
511impl From<&ExprBlock> for syn::ExprBlock {
512 fn from(node: &ExprBlock) -> Self {
513 Self {
514 attrs: node.attrs.map_into(),
515 label: node.label.map_into(),
516 block: node.block.ref_into(),
517 }
518 }
519}
520syn_trait_impl!(syn::ExprBreak);
521impl From<&syn::ExprBreak> for ExprBreak {
522 fn from(node: &syn::ExprBreak) -> Self {
523 Self {
524 attrs: node.attrs.map_into(),
525 label: node.label.map_into(),
526 expr: node.expr.ref_map(MapInto::map_into),
527 }
528 }
529}
530impl From<&ExprBreak> for syn::ExprBreak {
531 fn from(node: &ExprBreak) -> Self {
532 Self {
533 attrs: node.attrs.map_into(),
534 break_token: default(),
535 label: node.label.map_into(),
536 expr: node.expr.ref_map(MapInto::map_into),
537 }
538 }
539}
540syn_trait_impl!(syn::ExprCall);
541impl From<&syn::ExprCall> for ExprCall {
542 fn from(node: &syn::ExprCall) -> Self {
543 Self {
544 attrs: node.attrs.map_into(),
545 func: node.func.map_into(),
546 args: node.args.map_into(),
547 }
548 }
549}
550impl From<&ExprCall> for syn::ExprCall {
551 fn from(node: &ExprCall) -> Self {
552 Self {
553 attrs: node.attrs.map_into(),
554 func: node.func.map_into(),
555 paren_token: default(),
556 args: node.args.map_into(),
557 }
558 }
559}
560syn_trait_impl!(syn::ExprCast);
561impl From<&syn::ExprCast> for ExprCast {
562 fn from(node: &syn::ExprCast) -> Self {
563 Self {
564 attrs: node.attrs.map_into(),
565 expr: node.expr.map_into(),
566 ty: node.ty.map_into(),
567 }
568 }
569}
570impl From<&ExprCast> for syn::ExprCast {
571 fn from(node: &ExprCast) -> Self {
572 Self {
573 attrs: node.attrs.map_into(),
574 expr: node.expr.map_into(),
575 as_token: default(),
576 ty: node.ty.map_into(),
577 }
578 }
579}
580syn_trait_impl!(syn::ExprClosure);
581impl From<&syn::ExprClosure> for ExprClosure {
582 fn from(node: &syn::ExprClosure) -> Self {
583 Self {
584 attrs: node.attrs.map_into(),
585 lifetimes: node.lifetimes.map_into(),
586 constness: node.constness.is_some(),
587 movability: node.movability.is_some(),
588 asyncness: node.asyncness.is_some(),
589 capture: node.capture.is_some(),
590 inputs: node.inputs.map_into(),
591 output: node.output.ref_into(),
592 body: node.body.map_into(),
593 }
594 }
595}
596impl From<&ExprClosure> for syn::ExprClosure {
597 fn from(node: &ExprClosure) -> Self {
598 Self {
599 attrs: node.attrs.map_into(),
600 lifetimes: node.lifetimes.map_into(),
601 constness: default_or_none(node.constness),
602 movability: default_or_none(node.movability),
603 asyncness: default_or_none(node.asyncness),
604 capture: default_or_none(node.capture),
605 or1_token: default(),
606 inputs: node.inputs.map_into(),
607 or2_token: default(),
608 output: node.output.ref_into(),
609 body: node.body.map_into(),
610 }
611 }
612}
613syn_trait_impl!(syn::ExprConst);
614impl From<&syn::ExprConst> for ExprConst {
615 fn from(node: &syn::ExprConst) -> Self {
616 Self {
617 attrs: node.attrs.map_into(),
618 block: node.block.ref_into(),
619 }
620 }
621}
622impl From<&ExprConst> for syn::ExprConst {
623 fn from(node: &ExprConst) -> Self {
624 Self {
625 attrs: node.attrs.map_into(),
626 const_token: default(),
627 block: node.block.ref_into(),
628 }
629 }
630}
631syn_trait_impl!(syn::ExprContinue);
632impl From<&syn::ExprContinue> for ExprContinue {
633 fn from(node: &syn::ExprContinue) -> Self {
634 Self {
635 attrs: node.attrs.map_into(),
636 label: node.label.map_into(),
637 }
638 }
639}
640impl From<&ExprContinue> for syn::ExprContinue {
641 fn from(node: &ExprContinue) -> Self {
642 Self {
643 attrs: node.attrs.map_into(),
644 continue_token: default(),
645 label: node.label.map_into(),
646 }
647 }
648}
649syn_trait_impl!(syn::ExprField);
650impl From<&syn::ExprField> for ExprField {
651 fn from(node: &syn::ExprField) -> Self {
652 Self {
653 attrs: node.attrs.map_into(),
654 base: node.base.map_into(),
655 member: node.member.ref_into(),
656 }
657 }
658}
659impl From<&ExprField> for syn::ExprField {
660 fn from(node: &ExprField) -> Self {
661 Self {
662 attrs: node.attrs.map_into(),
663 base: node.base.map_into(),
664 dot_token: default(),
665 member: node.member.ref_into(),
666 }
667 }
668}
669syn_trait_impl!(syn::ExprForLoop);
670impl From<&syn::ExprForLoop> for ExprForLoop {
671 fn from(node: &syn::ExprForLoop) -> Self {
672 Self {
673 attrs: node.attrs.map_into(),
674 label: node.label.map_into(),
675 pat: node.pat.map_into(),
676 expr: node.expr.map_into(),
677 body: node.body.ref_into(),
678 }
679 }
680}
681impl From<&ExprForLoop> for syn::ExprForLoop {
682 fn from(node: &ExprForLoop) -> Self {
683 Self {
684 attrs: node.attrs.map_into(),
685 label: node.label.map_into(),
686 for_token: default(),
687 pat: node.pat.map_into(),
688 in_token: default(),
689 expr: node.expr.map_into(),
690 body: node.body.ref_into(),
691 }
692 }
693}
694syn_trait_impl!(syn::ExprGroup);
695impl From<&syn::ExprGroup> for ExprGroup {
696 fn from(node: &syn::ExprGroup) -> Self {
697 Self {
698 attrs: node.attrs.map_into(),
699 expr: node.expr.map_into(),
700 }
701 }
702}
703impl From<&ExprGroup> for syn::ExprGroup {
704 fn from(node: &ExprGroup) -> Self {
705 Self {
706 attrs: node.attrs.map_into(),
707 group_token: default(),
708 expr: node.expr.map_into(),
709 }
710 }
711}
712syn_trait_impl!(syn::ExprIf);
713impl From<&syn::ExprIf> for ExprIf {
714 fn from(node: &syn::ExprIf) -> Self {
715 Self {
716 attrs: node.attrs.map_into(),
717 cond: node.cond.map_into(),
718 then_branch: node.then_branch.ref_into(),
719 else_branch: node.else_branch.ref_map(|(_0, _1)| (*_1).map_into()),
720 }
721 }
722}
723impl From<&ExprIf> for syn::ExprIf {
724 fn from(node: &ExprIf) -> Self {
725 Self {
726 attrs: node.attrs.map_into(),
727 if_token: default(),
728 cond: node.cond.map_into(),
729 then_branch: node.then_branch.ref_into(),
730 else_branch: node.else_branch.ref_map(|_1| (default(), (*_1).map_into())),
731 }
732 }
733}
734syn_trait_impl!(syn::ExprIndex);
735impl From<&syn::ExprIndex> for ExprIndex {
736 fn from(node: &syn::ExprIndex) -> Self {
737 Self {
738 attrs: node.attrs.map_into(),
739 expr: node.expr.map_into(),
740 index: node.index.map_into(),
741 }
742 }
743}
744impl From<&ExprIndex> for syn::ExprIndex {
745 fn from(node: &ExprIndex) -> Self {
746 Self {
747 attrs: node.attrs.map_into(),
748 expr: node.expr.map_into(),
749 bracket_token: default(),
750 index: node.index.map_into(),
751 }
752 }
753}
754syn_trait_impl!(syn::ExprInfer);
755impl From<&syn::ExprInfer> for ExprInfer {
756 fn from(node: &syn::ExprInfer) -> Self {
757 Self {
758 attrs: node.attrs.map_into(),
759 }
760 }
761}
762impl From<&ExprInfer> for syn::ExprInfer {
763 fn from(node: &ExprInfer) -> Self {
764 Self {
765 attrs: node.attrs.map_into(),
766 underscore_token: default(),
767 }
768 }
769}
770syn_trait_impl!(syn::ExprLet);
771impl From<&syn::ExprLet> for ExprLet {
772 fn from(node: &syn::ExprLet) -> Self {
773 Self {
774 attrs: node.attrs.map_into(),
775 pat: node.pat.map_into(),
776 expr: node.expr.map_into(),
777 }
778 }
779}
780impl From<&ExprLet> for syn::ExprLet {
781 fn from(node: &ExprLet) -> Self {
782 Self {
783 attrs: node.attrs.map_into(),
784 let_token: default(),
785 pat: node.pat.map_into(),
786 eq_token: default(),
787 expr: node.expr.map_into(),
788 }
789 }
790}
791syn_trait_impl!(syn::ExprLit);
792impl From<&syn::ExprLit> for ExprLit {
793 fn from(node: &syn::ExprLit) -> Self {
794 Self {
795 attrs: node.attrs.map_into(),
796 lit: node.lit.ref_into(),
797 }
798 }
799}
800impl From<&ExprLit> for syn::ExprLit {
801 fn from(node: &ExprLit) -> Self {
802 Self {
803 attrs: node.attrs.map_into(),
804 lit: node.lit.ref_into(),
805 }
806 }
807}
808syn_trait_impl!(syn::ExprLoop);
809impl From<&syn::ExprLoop> for ExprLoop {
810 fn from(node: &syn::ExprLoop) -> Self {
811 Self {
812 attrs: node.attrs.map_into(),
813 label: node.label.map_into(),
814 body: node.body.ref_into(),
815 }
816 }
817}
818impl From<&ExprLoop> for syn::ExprLoop {
819 fn from(node: &ExprLoop) -> Self {
820 Self {
821 attrs: node.attrs.map_into(),
822 label: node.label.map_into(),
823 loop_token: default(),
824 body: node.body.ref_into(),
825 }
826 }
827}
828syn_trait_impl!(syn::ExprMacro);
829impl From<&syn::ExprMacro> for ExprMacro {
830 fn from(node: &syn::ExprMacro) -> Self {
831 Self {
832 attrs: node.attrs.map_into(),
833 mac: node.mac.ref_into(),
834 }
835 }
836}
837impl From<&ExprMacro> for syn::ExprMacro {
838 fn from(node: &ExprMacro) -> Self {
839 Self {
840 attrs: node.attrs.map_into(),
841 mac: node.mac.ref_into(),
842 }
843 }
844}
845syn_trait_impl!(syn::ExprMethodCall);
846impl From<&syn::ExprMethodCall> for ExprMethodCall {
847 fn from(node: &syn::ExprMethodCall) -> Self {
848 Self {
849 attrs: node.attrs.map_into(),
850 receiver: node.receiver.map_into(),
851 method: node.method.ref_into(),
852 turbofish: node.turbofish.map_into(),
853 args: node.args.map_into(),
854 }
855 }
856}
857impl From<&ExprMethodCall> for syn::ExprMethodCall {
858 fn from(node: &ExprMethodCall) -> Self {
859 Self {
860 attrs: node.attrs.map_into(),
861 receiver: node.receiver.map_into(),
862 dot_token: default(),
863 method: node.method.ref_into(),
864 turbofish: node.turbofish.map_into(),
865 paren_token: default(),
866 args: node.args.map_into(),
867 }
868 }
869}
870syn_trait_impl!(syn::ExprParen);
871impl From<&syn::ExprParen> for ExprParen {
872 fn from(node: &syn::ExprParen) -> Self {
873 Self {
874 attrs: node.attrs.map_into(),
875 expr: node.expr.map_into(),
876 }
877 }
878}
879impl From<&ExprParen> for syn::ExprParen {
880 fn from(node: &ExprParen) -> Self {
881 Self {
882 attrs: node.attrs.map_into(),
883 paren_token: default(),
884 expr: node.expr.map_into(),
885 }
886 }
887}
888syn_trait_impl!(syn::ExprPath);
889impl From<&syn::ExprPath> for ExprPath {
890 fn from(node: &syn::ExprPath) -> Self {
891 Self {
892 attrs: node.attrs.map_into(),
893 qself: node.qself.map_into(),
894 path: node.path.ref_into(),
895 }
896 }
897}
898impl From<&ExprPath> for syn::ExprPath {
899 fn from(node: &ExprPath) -> Self {
900 Self {
901 attrs: node.attrs.map_into(),
902 qself: node.qself.map_into(),
903 path: node.path.ref_into(),
904 }
905 }
906}
907syn_trait_impl!(syn::ExprRange);
908impl From<&syn::ExprRange> for ExprRange {
909 fn from(node: &syn::ExprRange) -> Self {
910 Self {
911 attrs: node.attrs.map_into(),
912 start: node.start.ref_map(MapInto::map_into),
913 limits: node.limits.ref_into(),
914 end: node.end.ref_map(MapInto::map_into),
915 }
916 }
917}
918impl From<&ExprRange> for syn::ExprRange {
919 fn from(node: &ExprRange) -> Self {
920 Self {
921 attrs: node.attrs.map_into(),
922 start: node.start.ref_map(MapInto::map_into),
923 limits: node.limits.ref_into(),
924 end: node.end.ref_map(MapInto::map_into),
925 }
926 }
927}
928syn_trait_impl!(syn::ExprReference);
929impl From<&syn::ExprReference> for ExprReference {
930 fn from(node: &syn::ExprReference) -> Self {
931 Self {
932 attrs: node.attrs.map_into(),
933 mutability: node.mutability.is_some(),
934 expr: node.expr.map_into(),
935 }
936 }
937}
938impl From<&ExprReference> for syn::ExprReference {
939 fn from(node: &ExprReference) -> Self {
940 Self {
941 attrs: node.attrs.map_into(),
942 and_token: default(),
943 mutability: default_or_none(node.mutability),
944 expr: node.expr.map_into(),
945 }
946 }
947}
948syn_trait_impl!(syn::ExprRepeat);
949impl From<&syn::ExprRepeat> for ExprRepeat {
950 fn from(node: &syn::ExprRepeat) -> Self {
951 Self {
952 attrs: node.attrs.map_into(),
953 expr: node.expr.map_into(),
954 len: node.len.map_into(),
955 }
956 }
957}
958impl From<&ExprRepeat> for syn::ExprRepeat {
959 fn from(node: &ExprRepeat) -> Self {
960 Self {
961 attrs: node.attrs.map_into(),
962 bracket_token: default(),
963 expr: node.expr.map_into(),
964 semi_token: default(),
965 len: node.len.map_into(),
966 }
967 }
968}
969syn_trait_impl!(syn::ExprReturn);
970impl From<&syn::ExprReturn> for ExprReturn {
971 fn from(node: &syn::ExprReturn) -> Self {
972 Self {
973 attrs: node.attrs.map_into(),
974 expr: node.expr.ref_map(MapInto::map_into),
975 }
976 }
977}
978impl From<&ExprReturn> for syn::ExprReturn {
979 fn from(node: &ExprReturn) -> Self {
980 Self {
981 attrs: node.attrs.map_into(),
982 return_token: default(),
983 expr: node.expr.ref_map(MapInto::map_into),
984 }
985 }
986}
987syn_trait_impl!(syn::ExprStruct);
988impl From<&syn::ExprStruct> for ExprStruct {
989 fn from(node: &syn::ExprStruct) -> Self {
990 Self {
991 attrs: node.attrs.map_into(),
992 qself: node.qself.map_into(),
993 path: node.path.ref_into(),
994 fields: node.fields.map_into(),
995 dot2_token: node.dot2_token.is_some(),
996 rest: node.rest.ref_map(MapInto::map_into),
997 }
998 }
999}
1000impl From<&ExprStruct> for syn::ExprStruct {
1001 fn from(node: &ExprStruct) -> Self {
1002 Self {
1003 attrs: node.attrs.map_into(),
1004 qself: node.qself.map_into(),
1005 path: node.path.ref_into(),
1006 brace_token: default(),
1007 fields: node.fields.map_into(),
1008 dot2_token: default_or_none(node.dot2_token),
1009 rest: node.rest.ref_map(MapInto::map_into),
1010 }
1011 }
1012}
1013syn_trait_impl!(syn::ExprTry);
1014impl From<&syn::ExprTry> for ExprTry {
1015 fn from(node: &syn::ExprTry) -> Self {
1016 Self {
1017 attrs: node.attrs.map_into(),
1018 expr: node.expr.map_into(),
1019 }
1020 }
1021}
1022impl From<&ExprTry> for syn::ExprTry {
1023 fn from(node: &ExprTry) -> Self {
1024 Self {
1025 attrs: node.attrs.map_into(),
1026 expr: node.expr.map_into(),
1027 question_token: default(),
1028 }
1029 }
1030}
1031syn_trait_impl!(syn::ExprTryBlock);
1032impl From<&syn::ExprTryBlock> for ExprTryBlock {
1033 fn from(node: &syn::ExprTryBlock) -> Self {
1034 Self {
1035 attrs: node.attrs.map_into(),
1036 block: node.block.ref_into(),
1037 }
1038 }
1039}
1040impl From<&ExprTryBlock> for syn::ExprTryBlock {
1041 fn from(node: &ExprTryBlock) -> Self {
1042 Self {
1043 attrs: node.attrs.map_into(),
1044 try_token: default(),
1045 block: node.block.ref_into(),
1046 }
1047 }
1048}
1049syn_trait_impl!(syn::ExprTuple);
1050impl From<&syn::ExprTuple> for ExprTuple {
1051 fn from(node: &syn::ExprTuple) -> Self {
1052 Self {
1053 attrs: node.attrs.map_into(),
1054 elems: node.elems.map_into(),
1055 }
1056 }
1057}
1058impl From<&ExprTuple> for syn::ExprTuple {
1059 fn from(node: &ExprTuple) -> Self {
1060 Self {
1061 attrs: node.attrs.map_into(),
1062 paren_token: default(),
1063 elems: node.elems.map_into(),
1064 }
1065 }
1066}
1067syn_trait_impl!(syn::ExprUnary);
1068impl From<&syn::ExprUnary> for ExprUnary {
1069 fn from(node: &syn::ExprUnary) -> Self {
1070 Self {
1071 attrs: node.attrs.map_into(),
1072 op: node.op.ref_into(),
1073 expr: node.expr.map_into(),
1074 }
1075 }
1076}
1077impl From<&ExprUnary> for syn::ExprUnary {
1078 fn from(node: &ExprUnary) -> Self {
1079 Self {
1080 attrs: node.attrs.map_into(),
1081 op: node.op.ref_into(),
1082 expr: node.expr.map_into(),
1083 }
1084 }
1085}
1086syn_trait_impl!(syn::ExprUnsafe);
1087impl From<&syn::ExprUnsafe> for ExprUnsafe {
1088 fn from(node: &syn::ExprUnsafe) -> Self {
1089 Self {
1090 attrs: node.attrs.map_into(),
1091 block: node.block.ref_into(),
1092 }
1093 }
1094}
1095impl From<&ExprUnsafe> for syn::ExprUnsafe {
1096 fn from(node: &ExprUnsafe) -> Self {
1097 Self {
1098 attrs: node.attrs.map_into(),
1099 unsafe_token: default(),
1100 block: node.block.ref_into(),
1101 }
1102 }
1103}
1104syn_trait_impl!(syn::ExprWhile);
1105impl From<&syn::ExprWhile> for ExprWhile {
1106 fn from(node: &syn::ExprWhile) -> Self {
1107 Self {
1108 attrs: node.attrs.map_into(),
1109 label: node.label.map_into(),
1110 cond: node.cond.map_into(),
1111 body: node.body.ref_into(),
1112 }
1113 }
1114}
1115impl From<&ExprWhile> for syn::ExprWhile {
1116 fn from(node: &ExprWhile) -> Self {
1117 Self {
1118 attrs: node.attrs.map_into(),
1119 label: node.label.map_into(),
1120 while_token: default(),
1121 cond: node.cond.map_into(),
1122 body: node.body.ref_into(),
1123 }
1124 }
1125}
1126syn_trait_impl!(syn::ExprYield);
1127impl From<&syn::ExprYield> for ExprYield {
1128 fn from(node: &syn::ExprYield) -> Self {
1129 Self {
1130 attrs: node.attrs.map_into(),
1131 expr: node.expr.ref_map(MapInto::map_into),
1132 }
1133 }
1134}
1135impl From<&ExprYield> for syn::ExprYield {
1136 fn from(node: &ExprYield) -> Self {
1137 Self {
1138 attrs: node.attrs.map_into(),
1139 yield_token: default(),
1140 expr: node.expr.ref_map(MapInto::map_into),
1141 }
1142 }
1143}
1144syn_trait_impl!(syn::Field);
1145impl From<&syn::Field> for Field {
1146 fn from(node: &syn::Field) -> Self {
1147 Self {
1148 attrs: node.attrs.map_into(),
1149 vis: node.vis.ref_into(),
1150 mutability: node.mutability.ref_into(),
1151 ident: node.ident.map_into(),
1152 colon_token: node.colon_token.is_some(),
1153 ty: node.ty.ref_into(),
1154 }
1155 }
1156}
1157impl From<&Field> for syn::Field {
1158 fn from(node: &Field) -> Self {
1159 Self {
1160 attrs: node.attrs.map_into(),
1161 vis: node.vis.ref_into(),
1162 mutability: node.mutability.ref_into(),
1163 ident: node.ident.map_into(),
1164 colon_token: default_or_none(node.colon_token),
1165 ty: node.ty.ref_into(),
1166 }
1167 }
1168}
1169syn_trait_impl!(syn::FieldMutability);
1170impl From<&syn::FieldMutability> for FieldMutability {
1171 fn from(node: &syn::FieldMutability) -> Self {
1172 match node {
1173 syn::FieldMutability::None => FieldMutability::None,
1174 _ => unreachable!(),
1175 }
1176 }
1177}
1178impl From<&FieldMutability> for syn::FieldMutability {
1179 fn from(node: &FieldMutability) -> Self {
1180 match node {
1181 FieldMutability::None => syn::FieldMutability::None,
1182 }
1183 }
1184}
1185syn_trait_impl!(syn::FieldPat);
1186impl From<&syn::FieldPat> for FieldPat {
1187 fn from(node: &syn::FieldPat) -> Self {
1188 Self {
1189 attrs: node.attrs.map_into(),
1190 member: node.member.ref_into(),
1191 colon_token: node.colon_token.is_some(),
1192 pat: node.pat.map_into(),
1193 }
1194 }
1195}
1196impl From<&FieldPat> for syn::FieldPat {
1197 fn from(node: &FieldPat) -> Self {
1198 Self {
1199 attrs: node.attrs.map_into(),
1200 member: node.member.ref_into(),
1201 colon_token: default_or_none(node.colon_token),
1202 pat: node.pat.map_into(),
1203 }
1204 }
1205}
1206syn_trait_impl!(syn::FieldValue);
1207impl From<&syn::FieldValue> for FieldValue {
1208 fn from(node: &syn::FieldValue) -> Self {
1209 Self {
1210 attrs: node.attrs.map_into(),
1211 member: node.member.ref_into(),
1212 colon_token: node.colon_token.is_some(),
1213 expr: node.expr.ref_into(),
1214 }
1215 }
1216}
1217impl From<&FieldValue> for syn::FieldValue {
1218 fn from(node: &FieldValue) -> Self {
1219 Self {
1220 attrs: node.attrs.map_into(),
1221 member: node.member.ref_into(),
1222 colon_token: default_or_none(node.colon_token),
1223 expr: node.expr.ref_into(),
1224 }
1225 }
1226}
1227syn_trait_impl!(syn::Fields);
1228impl From<&syn::Fields> for Fields {
1229 fn from(node: &syn::Fields) -> Self {
1230 match node {
1231 syn::Fields::Named(_0) => Fields::Named((*_0).ref_into()),
1232 syn::Fields::Unnamed(_0) => Fields::Unnamed((*_0).ref_into()),
1233 syn::Fields::Unit => Fields::Unit,
1234 }
1235 }
1236}
1237impl From<&Fields> for syn::Fields {
1238 fn from(node: &Fields) -> Self {
1239 match node {
1240 Fields::Named(_0) => syn::Fields::Named((*_0).ref_into()),
1241 Fields::Unnamed(_0) => syn::Fields::Unnamed((*_0).ref_into()),
1242 Fields::Unit => syn::Fields::Unit,
1243 }
1244 }
1245}
1246syn_trait_impl!(syn::FieldsNamed);
1247impl From<&syn::FieldsNamed> for FieldsNamed {
1248 fn from(node: &syn::FieldsNamed) -> Self {
1249 Self {
1250 named: node.named.map_into(),
1251 }
1252 }
1253}
1254impl From<&FieldsNamed> for syn::FieldsNamed {
1255 fn from(node: &FieldsNamed) -> Self {
1256 Self {
1257 brace_token: default(),
1258 named: node.named.map_into(),
1259 }
1260 }
1261}
1262syn_trait_impl!(syn::FieldsUnnamed);
1263impl From<&syn::FieldsUnnamed> for FieldsUnnamed {
1264 fn from(node: &syn::FieldsUnnamed) -> Self {
1265 Self {
1266 unnamed: node.unnamed.map_into(),
1267 }
1268 }
1269}
1270impl From<&FieldsUnnamed> for syn::FieldsUnnamed {
1271 fn from(node: &FieldsUnnamed) -> Self {
1272 Self {
1273 paren_token: default(),
1274 unnamed: node.unnamed.map_into(),
1275 }
1276 }
1277}
1278syn_trait_impl!(syn::File);
1279impl From<&syn::File> for File {
1280 fn from(node: &syn::File) -> Self {
1281 Self {
1282 shebang: node.shebang.map_into(),
1283 attrs: node.attrs.map_into(),
1284 items: node.items.map_into(),
1285 }
1286 }
1287}
1288impl From<&File> for syn::File {
1289 fn from(node: &File) -> Self {
1290 Self {
1291 shebang: node.shebang.map_into(),
1292 attrs: node.attrs.map_into(),
1293 items: node.items.map_into(),
1294 }
1295 }
1296}
1297syn_trait_impl!(syn::FnArg);
1298impl From<&syn::FnArg> for FnArg {
1299 fn from(node: &syn::FnArg) -> Self {
1300 match node {
1301 syn::FnArg::Receiver(_0) => FnArg::Receiver((*_0).ref_into()),
1302 syn::FnArg::Typed(_0) => FnArg::Typed((*_0).ref_into()),
1303 }
1304 }
1305}
1306impl From<&FnArg> for syn::FnArg {
1307 fn from(node: &FnArg) -> Self {
1308 match node {
1309 FnArg::Receiver(_0) => syn::FnArg::Receiver((*_0).ref_into()),
1310 FnArg::Typed(_0) => syn::FnArg::Typed((*_0).ref_into()),
1311 }
1312 }
1313}
1314syn_trait_impl!(syn::ForeignItem);
1315impl From<&syn::ForeignItem> for ForeignItem {
1316 fn from(node: &syn::ForeignItem) -> Self {
1317 match node {
1318 syn::ForeignItem::Fn(_0) => ForeignItem::Fn((*_0).ref_into()),
1319 syn::ForeignItem::Static(_0) => ForeignItem::Static((*_0).ref_into()),
1320 syn::ForeignItem::Type(_0) => ForeignItem::Type((*_0).ref_into()),
1321 syn::ForeignItem::Macro(_0) => ForeignItem::Macro((*_0).ref_into()),
1322 syn::ForeignItem::Verbatim(_0) => ForeignItem::Verbatim((*_0).ref_into()),
1323 _ => unreachable!(),
1324 }
1325 }
1326}
1327impl From<&ForeignItem> for syn::ForeignItem {
1328 fn from(node: &ForeignItem) -> Self {
1329 match node {
1330 ForeignItem::Fn(_0) => syn::ForeignItem::Fn((*_0).ref_into()),
1331 ForeignItem::Static(_0) => syn::ForeignItem::Static((*_0).ref_into()),
1332 ForeignItem::Type(_0) => syn::ForeignItem::Type((*_0).ref_into()),
1333 ForeignItem::Macro(_0) => syn::ForeignItem::Macro((*_0).ref_into()),
1334 ForeignItem::Verbatim(_0) => syn::ForeignItem::Verbatim((*_0).ref_into()),
1335 }
1336 }
1337}
1338syn_trait_impl!(syn::ForeignItemFn);
1339impl From<&syn::ForeignItemFn> for ForeignItemFn {
1340 fn from(node: &syn::ForeignItemFn) -> Self {
1341 Self {
1342 attrs: node.attrs.map_into(),
1343 vis: node.vis.ref_into(),
1344 sig: node.sig.ref_into(),
1345 }
1346 }
1347}
1348impl From<&ForeignItemFn> for syn::ForeignItemFn {
1349 fn from(node: &ForeignItemFn) -> Self {
1350 Self {
1351 attrs: node.attrs.map_into(),
1352 vis: node.vis.ref_into(),
1353 sig: node.sig.ref_into(),
1354 semi_token: default(),
1355 }
1356 }
1357}
1358syn_trait_impl!(syn::ForeignItemMacro);
1359impl From<&syn::ForeignItemMacro> for ForeignItemMacro {
1360 fn from(node: &syn::ForeignItemMacro) -> Self {
1361 Self {
1362 attrs: node.attrs.map_into(),
1363 mac: node.mac.ref_into(),
1364 semi_token: node.semi_token.is_some(),
1365 }
1366 }
1367}
1368impl From<&ForeignItemMacro> for syn::ForeignItemMacro {
1369 fn from(node: &ForeignItemMacro) -> Self {
1370 Self {
1371 attrs: node.attrs.map_into(),
1372 mac: node.mac.ref_into(),
1373 semi_token: default_or_none(node.semi_token),
1374 }
1375 }
1376}
1377syn_trait_impl!(syn::ForeignItemStatic);
1378impl From<&syn::ForeignItemStatic> for ForeignItemStatic {
1379 fn from(node: &syn::ForeignItemStatic) -> Self {
1380 Self {
1381 attrs: node.attrs.map_into(),
1382 vis: node.vis.ref_into(),
1383 mutability: node.mutability.ref_into(),
1384 ident: node.ident.ref_into(),
1385 ty: node.ty.map_into(),
1386 }
1387 }
1388}
1389impl From<&ForeignItemStatic> for syn::ForeignItemStatic {
1390 fn from(node: &ForeignItemStatic) -> Self {
1391 Self {
1392 attrs: node.attrs.map_into(),
1393 vis: node.vis.ref_into(),
1394 static_token: default(),
1395 mutability: node.mutability.ref_into(),
1396 ident: node.ident.ref_into(),
1397 colon_token: default(),
1398 ty: node.ty.map_into(),
1399 semi_token: default(),
1400 }
1401 }
1402}
1403syn_trait_impl!(syn::ForeignItemType);
1404impl From<&syn::ForeignItemType> for ForeignItemType {
1405 fn from(node: &syn::ForeignItemType) -> Self {
1406 Self {
1407 attrs: node.attrs.map_into(),
1408 vis: node.vis.ref_into(),
1409 ident: node.ident.ref_into(),
1410 generics: node.generics.ref_into(),
1411 }
1412 }
1413}
1414impl From<&ForeignItemType> for syn::ForeignItemType {
1415 fn from(node: &ForeignItemType) -> Self {
1416 Self {
1417 attrs: node.attrs.map_into(),
1418 vis: node.vis.ref_into(),
1419 type_token: default(),
1420 ident: node.ident.ref_into(),
1421 generics: node.generics.ref_into(),
1422 semi_token: default(),
1423 }
1424 }
1425}
1426syn_trait_impl!(syn::GenericArgument);
1427impl From<&syn::GenericArgument> for GenericArgument {
1428 fn from(node: &syn::GenericArgument) -> Self {
1429 match node {
1430 syn::GenericArgument::Lifetime(_0) => {
1431 GenericArgument::Lifetime((*_0).ref_into())
1432 }
1433 syn::GenericArgument::Type(_0) => GenericArgument::Type((*_0).ref_into()),
1434 syn::GenericArgument::Const(_0) => GenericArgument::Const((*_0).ref_into()),
1435 syn::GenericArgument::AssocType(_0) => {
1436 GenericArgument::AssocType((*_0).ref_into())
1437 }
1438 syn::GenericArgument::AssocConst(_0) => {
1439 GenericArgument::AssocConst((*_0).ref_into())
1440 }
1441 syn::GenericArgument::Constraint(_0) => {
1442 GenericArgument::Constraint((*_0).ref_into())
1443 }
1444 _ => unreachable!(),
1445 }
1446 }
1447}
1448impl From<&GenericArgument> for syn::GenericArgument {
1449 fn from(node: &GenericArgument) -> Self {
1450 match node {
1451 GenericArgument::Lifetime(_0) => {
1452 syn::GenericArgument::Lifetime((*_0).ref_into())
1453 }
1454 GenericArgument::Type(_0) => syn::GenericArgument::Type((*_0).ref_into()),
1455 GenericArgument::Const(_0) => syn::GenericArgument::Const((*_0).ref_into()),
1456 GenericArgument::AssocType(_0) => {
1457 syn::GenericArgument::AssocType((*_0).ref_into())
1458 }
1459 GenericArgument::AssocConst(_0) => {
1460 syn::GenericArgument::AssocConst((*_0).ref_into())
1461 }
1462 GenericArgument::Constraint(_0) => {
1463 syn::GenericArgument::Constraint((*_0).ref_into())
1464 }
1465 }
1466 }
1467}
1468syn_trait_impl!(syn::GenericParam);
1469impl From<&syn::GenericParam> for GenericParam {
1470 fn from(node: &syn::GenericParam) -> Self {
1471 match node {
1472 syn::GenericParam::Lifetime(_0) => GenericParam::Lifetime((*_0).ref_into()),
1473 syn::GenericParam::Type(_0) => GenericParam::Type((*_0).ref_into()),
1474 syn::GenericParam::Const(_0) => GenericParam::Const((*_0).ref_into()),
1475 }
1476 }
1477}
1478impl From<&GenericParam> for syn::GenericParam {
1479 fn from(node: &GenericParam) -> Self {
1480 match node {
1481 GenericParam::Lifetime(_0) => syn::GenericParam::Lifetime((*_0).ref_into()),
1482 GenericParam::Type(_0) => syn::GenericParam::Type((*_0).ref_into()),
1483 GenericParam::Const(_0) => syn::GenericParam::Const((*_0).ref_into()),
1484 }
1485 }
1486}
1487syn_trait_impl!(syn::ImplItem);
1488impl From<&syn::ImplItem> for ImplItem {
1489 fn from(node: &syn::ImplItem) -> Self {
1490 match node {
1491 syn::ImplItem::Const(_0) => ImplItem::Const((*_0).ref_into()),
1492 syn::ImplItem::Fn(_0) => ImplItem::Fn((*_0).ref_into()),
1493 syn::ImplItem::Type(_0) => ImplItem::Type((*_0).ref_into()),
1494 syn::ImplItem::Macro(_0) => ImplItem::Macro((*_0).ref_into()),
1495 syn::ImplItem::Verbatim(_0) => ImplItem::Verbatim((*_0).ref_into()),
1496 _ => unreachable!(),
1497 }
1498 }
1499}
1500impl From<&ImplItem> for syn::ImplItem {
1501 fn from(node: &ImplItem) -> Self {
1502 match node {
1503 ImplItem::Const(_0) => syn::ImplItem::Const((*_0).ref_into()),
1504 ImplItem::Fn(_0) => syn::ImplItem::Fn((*_0).ref_into()),
1505 ImplItem::Type(_0) => syn::ImplItem::Type((*_0).ref_into()),
1506 ImplItem::Macro(_0) => syn::ImplItem::Macro((*_0).ref_into()),
1507 ImplItem::Verbatim(_0) => syn::ImplItem::Verbatim((*_0).ref_into()),
1508 }
1509 }
1510}
1511syn_trait_impl!(syn::ImplItemConst);
1512impl From<&syn::ImplItemConst> for ImplItemConst {
1513 fn from(node: &syn::ImplItemConst) -> Self {
1514 Self {
1515 attrs: node.attrs.map_into(),
1516 vis: node.vis.ref_into(),
1517 defaultness: node.defaultness.is_some(),
1518 ident: node.ident.ref_into(),
1519 generics: node.generics.ref_into(),
1520 ty: node.ty.ref_into(),
1521 expr: node.expr.ref_into(),
1522 }
1523 }
1524}
1525impl From<&ImplItemConst> for syn::ImplItemConst {
1526 fn from(node: &ImplItemConst) -> Self {
1527 Self {
1528 attrs: node.attrs.map_into(),
1529 vis: node.vis.ref_into(),
1530 defaultness: default_or_none(node.defaultness),
1531 const_token: default(),
1532 ident: node.ident.ref_into(),
1533 generics: node.generics.ref_into(),
1534 colon_token: default(),
1535 ty: node.ty.ref_into(),
1536 eq_token: default(),
1537 expr: node.expr.ref_into(),
1538 semi_token: default(),
1539 }
1540 }
1541}
1542syn_trait_impl!(syn::ImplItemFn);
1543impl From<&syn::ImplItemFn> for ImplItemFn {
1544 fn from(node: &syn::ImplItemFn) -> Self {
1545 Self {
1546 attrs: node.attrs.map_into(),
1547 vis: node.vis.ref_into(),
1548 defaultness: node.defaultness.is_some(),
1549 sig: node.sig.ref_into(),
1550 block: node.block.ref_into(),
1551 }
1552 }
1553}
1554impl From<&ImplItemFn> for syn::ImplItemFn {
1555 fn from(node: &ImplItemFn) -> Self {
1556 Self {
1557 attrs: node.attrs.map_into(),
1558 vis: node.vis.ref_into(),
1559 defaultness: default_or_none(node.defaultness),
1560 sig: node.sig.ref_into(),
1561 block: node.block.ref_into(),
1562 }
1563 }
1564}
1565syn_trait_impl!(syn::ImplItemMacro);
1566impl From<&syn::ImplItemMacro> for ImplItemMacro {
1567 fn from(node: &syn::ImplItemMacro) -> Self {
1568 Self {
1569 attrs: node.attrs.map_into(),
1570 mac: node.mac.ref_into(),
1571 semi_token: node.semi_token.is_some(),
1572 }
1573 }
1574}
1575impl From<&ImplItemMacro> for syn::ImplItemMacro {
1576 fn from(node: &ImplItemMacro) -> Self {
1577 Self {
1578 attrs: node.attrs.map_into(),
1579 mac: node.mac.ref_into(),
1580 semi_token: default_or_none(node.semi_token),
1581 }
1582 }
1583}
1584syn_trait_impl!(syn::ImplItemType);
1585impl From<&syn::ImplItemType> for ImplItemType {
1586 fn from(node: &syn::ImplItemType) -> Self {
1587 Self {
1588 attrs: node.attrs.map_into(),
1589 vis: node.vis.ref_into(),
1590 defaultness: node.defaultness.is_some(),
1591 ident: node.ident.ref_into(),
1592 generics: node.generics.ref_into(),
1593 ty: node.ty.ref_into(),
1594 }
1595 }
1596}
1597impl From<&ImplItemType> for syn::ImplItemType {
1598 fn from(node: &ImplItemType) -> Self {
1599 Self {
1600 attrs: node.attrs.map_into(),
1601 vis: node.vis.ref_into(),
1602 defaultness: default_or_none(node.defaultness),
1603 type_token: default(),
1604 ident: node.ident.ref_into(),
1605 generics: node.generics.ref_into(),
1606 eq_token: default(),
1607 ty: node.ty.ref_into(),
1608 semi_token: default(),
1609 }
1610 }
1611}
1612syn_trait_impl!(syn::ImplRestriction);
1613impl From<&syn::ImplRestriction> for ImplRestriction {
1614 fn from(node: &syn::ImplRestriction) -> Self {
1615 match node {
1616 _ => unreachable!(),
1617 }
1618 }
1619}
1620impl From<&ImplRestriction> for syn::ImplRestriction {
1621 fn from(node: &ImplRestriction) -> Self {
1622 match node {
1623 _ => unreachable!(),
1624 }
1625 }
1626}
1627syn_trait_impl!(syn::Index);
1628impl From<&syn::Index> for Index {
1629 fn from(node: &syn::Index) -> Self {
1630 Self { index: node.index }
1631 }
1632}
1633impl From<&Index> for syn::Index {
1634 fn from(node: &Index) -> Self {
1635 Self {
1636 index: node.index,
1637 span: proc_macro2::Span::call_site(),
1638 }
1639 }
1640}
1641syn_trait_impl!(syn::Item);
1642impl From<&syn::Item> for Item {
1643 fn from(node: &syn::Item) -> Self {
1644 match node {
1645 syn::Item::Const(_0) => Item::Const((*_0).ref_into()),
1646 syn::Item::Enum(_0) => Item::Enum((*_0).ref_into()),
1647 syn::Item::ExternCrate(_0) => Item::ExternCrate((*_0).ref_into()),
1648 syn::Item::Fn(_0) => Item::Fn((*_0).ref_into()),
1649 syn::Item::ForeignMod(_0) => Item::ForeignMod((*_0).ref_into()),
1650 syn::Item::Impl(_0) => Item::Impl((*_0).ref_into()),
1651 syn::Item::Macro(_0) => Item::Macro((*_0).ref_into()),
1652 syn::Item::Mod(_0) => Item::Mod((*_0).ref_into()),
1653 syn::Item::Static(_0) => Item::Static((*_0).ref_into()),
1654 syn::Item::Struct(_0) => Item::Struct((*_0).ref_into()),
1655 syn::Item::Trait(_0) => Item::Trait((*_0).ref_into()),
1656 syn::Item::TraitAlias(_0) => Item::TraitAlias((*_0).ref_into()),
1657 syn::Item::Type(_0) => Item::Type((*_0).ref_into()),
1658 syn::Item::Union(_0) => Item::Union((*_0).ref_into()),
1659 syn::Item::Use(_0) => Item::Use((*_0).ref_into()),
1660 syn::Item::Verbatim(_0) => Item::Verbatim((*_0).ref_into()),
1661 _ => unreachable!(),
1662 }
1663 }
1664}
1665impl From<&Item> for syn::Item {
1666 fn from(node: &Item) -> Self {
1667 match node {
1668 Item::Const(_0) => syn::Item::Const((*_0).ref_into()),
1669 Item::Enum(_0) => syn::Item::Enum((*_0).ref_into()),
1670 Item::ExternCrate(_0) => syn::Item::ExternCrate((*_0).ref_into()),
1671 Item::Fn(_0) => syn::Item::Fn((*_0).ref_into()),
1672 Item::ForeignMod(_0) => syn::Item::ForeignMod((*_0).ref_into()),
1673 Item::Impl(_0) => syn::Item::Impl((*_0).ref_into()),
1674 Item::Macro(_0) => syn::Item::Macro((*_0).ref_into()),
1675 Item::Mod(_0) => syn::Item::Mod((*_0).ref_into()),
1676 Item::Static(_0) => syn::Item::Static((*_0).ref_into()),
1677 Item::Struct(_0) => syn::Item::Struct((*_0).ref_into()),
1678 Item::Trait(_0) => syn::Item::Trait((*_0).ref_into()),
1679 Item::TraitAlias(_0) => syn::Item::TraitAlias((*_0).ref_into()),
1680 Item::Type(_0) => syn::Item::Type((*_0).ref_into()),
1681 Item::Union(_0) => syn::Item::Union((*_0).ref_into()),
1682 Item::Use(_0) => syn::Item::Use((*_0).ref_into()),
1683 Item::Verbatim(_0) => syn::Item::Verbatim((*_0).ref_into()),
1684 }
1685 }
1686}
1687syn_trait_impl!(syn::ItemConst);
1688impl From<&syn::ItemConst> for ItemConst {
1689 fn from(node: &syn::ItemConst) -> Self {
1690 Self {
1691 attrs: node.attrs.map_into(),
1692 vis: node.vis.ref_into(),
1693 ident: node.ident.ref_into(),
1694 generics: node.generics.ref_into(),
1695 ty: node.ty.map_into(),
1696 expr: node.expr.map_into(),
1697 }
1698 }
1699}
1700impl From<&ItemConst> for syn::ItemConst {
1701 fn from(node: &ItemConst) -> Self {
1702 Self {
1703 attrs: node.attrs.map_into(),
1704 vis: node.vis.ref_into(),
1705 const_token: default(),
1706 ident: node.ident.ref_into(),
1707 generics: node.generics.ref_into(),
1708 colon_token: default(),
1709 ty: node.ty.map_into(),
1710 eq_token: default(),
1711 expr: node.expr.map_into(),
1712 semi_token: default(),
1713 }
1714 }
1715}
1716syn_trait_impl!(syn::ItemEnum);
1717impl From<&syn::ItemEnum> for ItemEnum {
1718 fn from(node: &syn::ItemEnum) -> Self {
1719 Self {
1720 attrs: node.attrs.map_into(),
1721 vis: node.vis.ref_into(),
1722 ident: node.ident.ref_into(),
1723 generics: node.generics.ref_into(),
1724 variants: node.variants.map_into(),
1725 }
1726 }
1727}
1728impl From<&ItemEnum> for syn::ItemEnum {
1729 fn from(node: &ItemEnum) -> Self {
1730 Self {
1731 attrs: node.attrs.map_into(),
1732 vis: node.vis.ref_into(),
1733 enum_token: default(),
1734 ident: node.ident.ref_into(),
1735 generics: node.generics.ref_into(),
1736 brace_token: default(),
1737 variants: node.variants.map_into(),
1738 }
1739 }
1740}
1741syn_trait_impl!(syn::ItemExternCrate);
1742impl From<&syn::ItemExternCrate> for ItemExternCrate {
1743 fn from(node: &syn::ItemExternCrate) -> Self {
1744 Self {
1745 attrs: node.attrs.map_into(),
1746 vis: node.vis.ref_into(),
1747 ident: node.ident.ref_into(),
1748 rename: node.rename.ref_map(|(_0, _1)| (*_1).ref_into()),
1749 }
1750 }
1751}
1752impl From<&ItemExternCrate> for syn::ItemExternCrate {
1753 fn from(node: &ItemExternCrate) -> Self {
1754 Self {
1755 attrs: node.attrs.map_into(),
1756 vis: node.vis.ref_into(),
1757 extern_token: default(),
1758 crate_token: default(),
1759 ident: node.ident.ref_into(),
1760 rename: node.rename.ref_map(|_1| (default(), (*_1).ref_into())),
1761 semi_token: default(),
1762 }
1763 }
1764}
1765syn_trait_impl!(syn::ItemFn);
1766impl From<&syn::ItemFn> for ItemFn {
1767 fn from(node: &syn::ItemFn) -> Self {
1768 Self {
1769 attrs: node.attrs.map_into(),
1770 vis: node.vis.ref_into(),
1771 sig: node.sig.ref_into(),
1772 block: node.block.map_into(),
1773 }
1774 }
1775}
1776impl From<&ItemFn> for syn::ItemFn {
1777 fn from(node: &ItemFn) -> Self {
1778 Self {
1779 attrs: node.attrs.map_into(),
1780 vis: node.vis.ref_into(),
1781 sig: node.sig.ref_into(),
1782 block: node.block.map_into(),
1783 }
1784 }
1785}
1786syn_trait_impl!(syn::ItemForeignMod);
1787impl From<&syn::ItemForeignMod> for ItemForeignMod {
1788 fn from(node: &syn::ItemForeignMod) -> Self {
1789 Self {
1790 attrs: node.attrs.map_into(),
1791 unsafety: node.unsafety.is_some(),
1792 abi: node.abi.ref_into(),
1793 items: node.items.map_into(),
1794 }
1795 }
1796}
1797impl From<&ItemForeignMod> for syn::ItemForeignMod {
1798 fn from(node: &ItemForeignMod) -> Self {
1799 Self {
1800 attrs: node.attrs.map_into(),
1801 unsafety: default_or_none(node.unsafety),
1802 abi: node.abi.ref_into(),
1803 brace_token: default(),
1804 items: node.items.map_into(),
1805 }
1806 }
1807}
1808syn_trait_impl!(syn::ItemImpl);
1809impl From<&syn::ItemImpl> for ItemImpl {
1810 fn from(node: &syn::ItemImpl) -> Self {
1811 Self {
1812 attrs: node.attrs.map_into(),
1813 defaultness: node.defaultness.is_some(),
1814 unsafety: node.unsafety.is_some(),
1815 generics: node.generics.ref_into(),
1816 trait_: node
1817 .trait_
1818 .ref_map(|(_0, _1, _2)| ((*_0).is_some(), (*_1).ref_into())),
1819 self_ty: node.self_ty.map_into(),
1820 items: node.items.map_into(),
1821 }
1822 }
1823}
1824impl From<&ItemImpl> for syn::ItemImpl {
1825 fn from(node: &ItemImpl) -> Self {
1826 Self {
1827 attrs: node.attrs.map_into(),
1828 defaultness: default_or_none(node.defaultness),
1829 unsafety: default_or_none(node.unsafety),
1830 impl_token: default(),
1831 generics: node.generics.ref_into(),
1832 trait_: node
1833 .trait_
1834 .ref_map(|(_0, _1)| (
1835 default_or_none((*_0)),
1836 (*_1).ref_into(),
1837 default(),
1838 )),
1839 self_ty: node.self_ty.map_into(),
1840 brace_token: default(),
1841 items: node.items.map_into(),
1842 }
1843 }
1844}
1845syn_trait_impl!(syn::ItemMacro);
1846impl From<&syn::ItemMacro> for ItemMacro {
1847 fn from(node: &syn::ItemMacro) -> Self {
1848 Self {
1849 attrs: node.attrs.map_into(),
1850 ident: node.ident.map_into(),
1851 mac: node.mac.ref_into(),
1852 semi_token: node.semi_token.is_some(),
1853 }
1854 }
1855}
1856impl From<&ItemMacro> for syn::ItemMacro {
1857 fn from(node: &ItemMacro) -> Self {
1858 Self {
1859 attrs: node.attrs.map_into(),
1860 ident: node.ident.map_into(),
1861 mac: node.mac.ref_into(),
1862 semi_token: default_or_none(node.semi_token),
1863 }
1864 }
1865}
1866syn_trait_impl!(syn::ItemMod);
1867impl From<&syn::ItemMod> for ItemMod {
1868 fn from(node: &syn::ItemMod) -> Self {
1869 Self {
1870 attrs: node.attrs.map_into(),
1871 vis: node.vis.ref_into(),
1872 unsafety: node.unsafety.is_some(),
1873 ident: node.ident.ref_into(),
1874 content: node.content.ref_map(|(_0, _1)| (*_1).map_into()),
1875 semi: node.semi.is_some(),
1876 }
1877 }
1878}
1879impl From<&ItemMod> for syn::ItemMod {
1880 fn from(node: &ItemMod) -> Self {
1881 Self {
1882 attrs: node.attrs.map_into(),
1883 vis: node.vis.ref_into(),
1884 unsafety: default_or_none(node.unsafety),
1885 mod_token: default(),
1886 ident: node.ident.ref_into(),
1887 content: node.content.ref_map(|_1| (default(), (*_1).map_into())),
1888 semi: default_or_none(node.semi),
1889 }
1890 }
1891}
1892syn_trait_impl!(syn::ItemStatic);
1893impl From<&syn::ItemStatic> for ItemStatic {
1894 fn from(node: &syn::ItemStatic) -> Self {
1895 Self {
1896 attrs: node.attrs.map_into(),
1897 vis: node.vis.ref_into(),
1898 mutability: node.mutability.ref_into(),
1899 ident: node.ident.ref_into(),
1900 ty: node.ty.map_into(),
1901 expr: node.expr.map_into(),
1902 }
1903 }
1904}
1905impl From<&ItemStatic> for syn::ItemStatic {
1906 fn from(node: &ItemStatic) -> Self {
1907 Self {
1908 attrs: node.attrs.map_into(),
1909 vis: node.vis.ref_into(),
1910 static_token: default(),
1911 mutability: node.mutability.ref_into(),
1912 ident: node.ident.ref_into(),
1913 colon_token: default(),
1914 ty: node.ty.map_into(),
1915 eq_token: default(),
1916 expr: node.expr.map_into(),
1917 semi_token: default(),
1918 }
1919 }
1920}
1921syn_trait_impl!(syn::ItemTrait);
1922impl From<&syn::ItemTrait> for ItemTrait {
1923 fn from(node: &syn::ItemTrait) -> Self {
1924 Self {
1925 attrs: node.attrs.map_into(),
1926 vis: node.vis.ref_into(),
1927 unsafety: node.unsafety.is_some(),
1928 auto_token: node.auto_token.is_some(),
1929 restriction: node.restriction.map_into(),
1930 ident: node.ident.ref_into(),
1931 generics: node.generics.ref_into(),
1932 colon_token: node.colon_token.is_some(),
1933 supertraits: node.supertraits.map_into(),
1934 items: node.items.map_into(),
1935 }
1936 }
1937}
1938impl From<&ItemTrait> for syn::ItemTrait {
1939 fn from(node: &ItemTrait) -> Self {
1940 Self {
1941 attrs: node.attrs.map_into(),
1942 vis: node.vis.ref_into(),
1943 unsafety: default_or_none(node.unsafety),
1944 auto_token: default_or_none(node.auto_token),
1945 restriction: node.restriction.map_into(),
1946 trait_token: default(),
1947 ident: node.ident.ref_into(),
1948 generics: node.generics.ref_into(),
1949 colon_token: default_or_none(node.colon_token),
1950 supertraits: node.supertraits.map_into(),
1951 brace_token: default(),
1952 items: node.items.map_into(),
1953 }
1954 }
1955}
1956syn_trait_impl!(syn::ItemTraitAlias);
1957impl From<&syn::ItemTraitAlias> for ItemTraitAlias {
1958 fn from(node: &syn::ItemTraitAlias) -> Self {
1959 Self {
1960 attrs: node.attrs.map_into(),
1961 vis: node.vis.ref_into(),
1962 ident: node.ident.ref_into(),
1963 generics: node.generics.ref_into(),
1964 bounds: node.bounds.map_into(),
1965 }
1966 }
1967}
1968impl From<&ItemTraitAlias> for syn::ItemTraitAlias {
1969 fn from(node: &ItemTraitAlias) -> Self {
1970 Self {
1971 attrs: node.attrs.map_into(),
1972 vis: node.vis.ref_into(),
1973 trait_token: default(),
1974 ident: node.ident.ref_into(),
1975 generics: node.generics.ref_into(),
1976 eq_token: default(),
1977 bounds: node.bounds.map_into(),
1978 semi_token: default(),
1979 }
1980 }
1981}
1982syn_trait_impl!(syn::ItemType);
1983impl From<&syn::ItemType> for ItemType {
1984 fn from(node: &syn::ItemType) -> Self {
1985 Self {
1986 attrs: node.attrs.map_into(),
1987 vis: node.vis.ref_into(),
1988 ident: node.ident.ref_into(),
1989 generics: node.generics.ref_into(),
1990 ty: node.ty.map_into(),
1991 }
1992 }
1993}
1994impl From<&ItemType> for syn::ItemType {
1995 fn from(node: &ItemType) -> Self {
1996 Self {
1997 attrs: node.attrs.map_into(),
1998 vis: node.vis.ref_into(),
1999 type_token: default(),
2000 ident: node.ident.ref_into(),
2001 generics: node.generics.ref_into(),
2002 eq_token: default(),
2003 ty: node.ty.map_into(),
2004 semi_token: default(),
2005 }
2006 }
2007}
2008syn_trait_impl!(syn::ItemUnion);
2009impl From<&syn::ItemUnion> for ItemUnion {
2010 fn from(node: &syn::ItemUnion) -> Self {
2011 Self {
2012 attrs: node.attrs.map_into(),
2013 vis: node.vis.ref_into(),
2014 ident: node.ident.ref_into(),
2015 generics: node.generics.ref_into(),
2016 fields: node.fields.ref_into(),
2017 }
2018 }
2019}
2020impl From<&ItemUnion> for syn::ItemUnion {
2021 fn from(node: &ItemUnion) -> Self {
2022 Self {
2023 attrs: node.attrs.map_into(),
2024 vis: node.vis.ref_into(),
2025 union_token: default(),
2026 ident: node.ident.ref_into(),
2027 generics: node.generics.ref_into(),
2028 fields: node.fields.ref_into(),
2029 }
2030 }
2031}
2032syn_trait_impl!(syn::ItemUse);
2033impl From<&syn::ItemUse> for ItemUse {
2034 fn from(node: &syn::ItemUse) -> Self {
2035 Self {
2036 attrs: node.attrs.map_into(),
2037 vis: node.vis.ref_into(),
2038 leading_colon: node.leading_colon.is_some(),
2039 tree: node.tree.ref_into(),
2040 }
2041 }
2042}
2043impl From<&ItemUse> for syn::ItemUse {
2044 fn from(node: &ItemUse) -> Self {
2045 Self {
2046 attrs: node.attrs.map_into(),
2047 vis: node.vis.ref_into(),
2048 use_token: default(),
2049 leading_colon: default_or_none(node.leading_colon),
2050 tree: node.tree.ref_into(),
2051 semi_token: default(),
2052 }
2053 }
2054}
2055syn_trait_impl!(syn::Label);
2056impl From<&syn::Label> for Label {
2057 fn from(node: &syn::Label) -> Self {
2058 Self { name: node.name.ref_into() }
2059 }
2060}
2061impl From<&Label> for syn::Label {
2062 fn from(node: &Label) -> Self {
2063 Self {
2064 name: node.name.ref_into(),
2065 colon_token: default(),
2066 }
2067 }
2068}
2069syn_trait_impl!(syn::Lifetime);
2070impl From<&syn::Lifetime> for Lifetime {
2071 fn from(node: &syn::Lifetime) -> Self {
2072 Self {
2073 ident: node.ident.ref_into(),
2074 }
2075 }
2076}
2077impl From<&Lifetime> for syn::Lifetime {
2078 fn from(node: &Lifetime) -> Self {
2079 Self {
2080 apostrophe: proc_macro2::Span::call_site(),
2081 ident: node.ident.ref_into(),
2082 }
2083 }
2084}
2085syn_trait_impl!(syn::LifetimeParam);
2086impl From<&syn::LifetimeParam> for LifetimeParam {
2087 fn from(node: &syn::LifetimeParam) -> Self {
2088 Self {
2089 attrs: node.attrs.map_into(),
2090 lifetime: node.lifetime.ref_into(),
2091 colon_token: node.colon_token.is_some(),
2092 bounds: node.bounds.map_into(),
2093 }
2094 }
2095}
2096impl From<&LifetimeParam> for syn::LifetimeParam {
2097 fn from(node: &LifetimeParam) -> Self {
2098 Self {
2099 attrs: node.attrs.map_into(),
2100 lifetime: node.lifetime.ref_into(),
2101 colon_token: default_or_none(node.colon_token),
2102 bounds: node.bounds.map_into(),
2103 }
2104 }
2105}
2106syn_trait_impl!(syn::Lit);
2107impl From<&syn::Lit> for Lit {
2108 fn from(node: &syn::Lit) -> Self {
2109 match node {
2110 syn::Lit::Str(_0) => Lit::Str((*_0).ref_into()),
2111 syn::Lit::ByteStr(_0) => Lit::ByteStr((*_0).ref_into()),
2112 syn::Lit::Byte(_0) => Lit::Byte((*_0).ref_into()),
2113 syn::Lit::Char(_0) => Lit::Char((*_0).ref_into()),
2114 syn::Lit::Int(_0) => Lit::Int((*_0).ref_into()),
2115 syn::Lit::Float(_0) => Lit::Float((*_0).ref_into()),
2116 syn::Lit::Bool(_0) => Lit::Bool((*_0).ref_into()),
2117 syn::Lit::Verbatim(_0) => Lit::Verbatim((*_0).ref_into()),
2118 _ => unreachable!(),
2119 }
2120 }
2121}
2122impl From<&Lit> for syn::Lit {
2123 fn from(node: &Lit) -> Self {
2124 match node {
2125 Lit::Str(_0) => syn::Lit::Str((*_0).ref_into()),
2126 Lit::ByteStr(_0) => syn::Lit::ByteStr((*_0).ref_into()),
2127 Lit::Byte(_0) => syn::Lit::Byte((*_0).ref_into()),
2128 Lit::Char(_0) => syn::Lit::Char((*_0).ref_into()),
2129 Lit::Int(_0) => syn::Lit::Int((*_0).ref_into()),
2130 Lit::Float(_0) => syn::Lit::Float((*_0).ref_into()),
2131 Lit::Bool(_0) => syn::Lit::Bool((*_0).ref_into()),
2132 Lit::Verbatim(_0) => syn::Lit::Verbatim((*_0).ref_into()),
2133 }
2134 }
2135}
2136syn_trait_impl!(syn::LitBool);
2137impl From<&syn::LitBool> for LitBool {
2138 fn from(node: &syn::LitBool) -> Self {
2139 Self { value: node.value }
2140 }
2141}
2142impl From<&LitBool> for syn::LitBool {
2143 fn from(node: &LitBool) -> Self {
2144 Self {
2145 value: node.value,
2146 span: proc_macro2::Span::call_site(),
2147 }
2148 }
2149}
2150syn_trait_impl!(syn::Local);
2151impl From<&syn::Local> for Local {
2152 fn from(node: &syn::Local) -> Self {
2153 Self {
2154 attrs: node.attrs.map_into(),
2155 pat: node.pat.ref_into(),
2156 init: node.init.map_into(),
2157 }
2158 }
2159}
2160impl From<&Local> for syn::Local {
2161 fn from(node: &Local) -> Self {
2162 Self {
2163 attrs: node.attrs.map_into(),
2164 let_token: default(),
2165 pat: node.pat.ref_into(),
2166 init: node.init.map_into(),
2167 semi_token: default(),
2168 }
2169 }
2170}
2171syn_trait_impl!(syn::LocalInit);
2172impl From<&syn::LocalInit> for LocalInit {
2173 fn from(node: &syn::LocalInit) -> Self {
2174 Self {
2175 expr: node.expr.map_into(),
2176 diverge: node.diverge.ref_map(|(_0, _1)| (*_1).map_into()),
2177 }
2178 }
2179}
2180impl From<&LocalInit> for syn::LocalInit {
2181 fn from(node: &LocalInit) -> Self {
2182 Self {
2183 eq_token: default(),
2184 expr: node.expr.map_into(),
2185 diverge: node.diverge.ref_map(|_1| (default(), (*_1).map_into())),
2186 }
2187 }
2188}
2189syn_trait_impl!(syn::Macro);
2190impl From<&syn::Macro> for Macro {
2191 fn from(node: &syn::Macro) -> Self {
2192 Self {
2193 path: node.path.ref_into(),
2194 delimiter: node.delimiter.ref_into(),
2195 tokens: node.tokens.ref_into(),
2196 }
2197 }
2198}
2199impl From<&Macro> for syn::Macro {
2200 fn from(node: &Macro) -> Self {
2201 Self {
2202 path: node.path.ref_into(),
2203 bang_token: default(),
2204 delimiter: node.delimiter.ref_into(),
2205 tokens: node.tokens.ref_into(),
2206 }
2207 }
2208}
2209syn_trait_impl!(syn::MacroDelimiter);
2210impl From<&syn::MacroDelimiter> for MacroDelimiter {
2211 fn from(node: &syn::MacroDelimiter) -> Self {
2212 match node {
2213 syn::MacroDelimiter::Paren(..) => MacroDelimiter::Paren,
2214 syn::MacroDelimiter::Brace(..) => MacroDelimiter::Brace,
2215 syn::MacroDelimiter::Bracket(..) => MacroDelimiter::Bracket,
2216 }
2217 }
2218}
2219impl From<&MacroDelimiter> for syn::MacroDelimiter {
2220 fn from(node: &MacroDelimiter) -> Self {
2221 match node {
2222 MacroDelimiter::Paren => syn::MacroDelimiter::Paren(default()),
2223 MacroDelimiter::Brace => syn::MacroDelimiter::Brace(default()),
2224 MacroDelimiter::Bracket => syn::MacroDelimiter::Bracket(default()),
2225 }
2226 }
2227}
2228syn_trait_impl!(syn::Member);
2229impl From<&syn::Member> for Member {
2230 fn from(node: &syn::Member) -> Self {
2231 match node {
2232 syn::Member::Named(_0) => Member::Named((*_0).ref_into()),
2233 syn::Member::Unnamed(_0) => Member::Unnamed((*_0).ref_into()),
2234 }
2235 }
2236}
2237impl From<&Member> for syn::Member {
2238 fn from(node: &Member) -> Self {
2239 match node {
2240 Member::Named(_0) => syn::Member::Named((*_0).ref_into()),
2241 Member::Unnamed(_0) => syn::Member::Unnamed((*_0).ref_into()),
2242 }
2243 }
2244}
2245syn_trait_impl!(syn::Meta);
2246impl From<&syn::Meta> for Meta {
2247 fn from(node: &syn::Meta) -> Self {
2248 match node {
2249 syn::Meta::Path(_0) => Meta::Path((*_0).ref_into()),
2250 syn::Meta::List(_0) => Meta::List((*_0).ref_into()),
2251 syn::Meta::NameValue(_0) => Meta::NameValue((*_0).ref_into()),
2252 }
2253 }
2254}
2255impl From<&Meta> for syn::Meta {
2256 fn from(node: &Meta) -> Self {
2257 match node {
2258 Meta::Path(_0) => syn::Meta::Path((*_0).ref_into()),
2259 Meta::List(_0) => syn::Meta::List((*_0).ref_into()),
2260 Meta::NameValue(_0) => syn::Meta::NameValue((*_0).ref_into()),
2261 }
2262 }
2263}
2264syn_trait_impl!(syn::MetaList);
2265impl From<&syn::MetaList> for MetaList {
2266 fn from(node: &syn::MetaList) -> Self {
2267 Self {
2268 path: node.path.ref_into(),
2269 delimiter: node.delimiter.ref_into(),
2270 tokens: node.tokens.ref_into(),
2271 }
2272 }
2273}
2274impl From<&MetaList> for syn::MetaList {
2275 fn from(node: &MetaList) -> Self {
2276 Self {
2277 path: node.path.ref_into(),
2278 delimiter: node.delimiter.ref_into(),
2279 tokens: node.tokens.ref_into(),
2280 }
2281 }
2282}
2283syn_trait_impl!(syn::MetaNameValue);
2284impl From<&syn::MetaNameValue> for MetaNameValue {
2285 fn from(node: &syn::MetaNameValue) -> Self {
2286 Self {
2287 path: node.path.ref_into(),
2288 value: node.value.ref_into(),
2289 }
2290 }
2291}
2292impl From<&MetaNameValue> for syn::MetaNameValue {
2293 fn from(node: &MetaNameValue) -> Self {
2294 Self {
2295 path: node.path.ref_into(),
2296 eq_token: default(),
2297 value: node.value.ref_into(),
2298 }
2299 }
2300}
2301syn_trait_impl!(syn::ParenthesizedGenericArguments);
2302impl From<&syn::ParenthesizedGenericArguments> for ParenthesizedGenericArguments {
2303 fn from(node: &syn::ParenthesizedGenericArguments) -> Self {
2304 Self {
2305 inputs: node.inputs.map_into(),
2306 output: node.output.ref_into(),
2307 }
2308 }
2309}
2310impl From<&ParenthesizedGenericArguments> for syn::ParenthesizedGenericArguments {
2311 fn from(node: &ParenthesizedGenericArguments) -> Self {
2312 Self {
2313 paren_token: default(),
2314 inputs: node.inputs.map_into(),
2315 output: node.output.ref_into(),
2316 }
2317 }
2318}
2319syn_trait_impl!(syn::Pat);
2320impl From<&syn::Pat> for Pat {
2321 fn from(node: &syn::Pat) -> Self {
2322 match node {
2323 syn::Pat::Const(_0) => Pat::Const((*_0).ref_into()),
2324 syn::Pat::Ident(_0) => Pat::Ident((*_0).ref_into()),
2325 syn::Pat::Lit(_0) => Pat::Lit((*_0).ref_into()),
2326 syn::Pat::Macro(_0) => Pat::Macro((*_0).ref_into()),
2327 syn::Pat::Or(_0) => Pat::Or((*_0).ref_into()),
2328 syn::Pat::Paren(_0) => Pat::Paren((*_0).ref_into()),
2329 syn::Pat::Path(_0) => Pat::Path((*_0).ref_into()),
2330 syn::Pat::Range(_0) => Pat::Range((*_0).ref_into()),
2331 syn::Pat::Reference(_0) => Pat::Reference((*_0).ref_into()),
2332 syn::Pat::Rest(_0) => Pat::Rest((*_0).ref_into()),
2333 syn::Pat::Slice(_0) => Pat::Slice((*_0).ref_into()),
2334 syn::Pat::Struct(_0) => Pat::Struct((*_0).ref_into()),
2335 syn::Pat::Tuple(_0) => Pat::Tuple((*_0).ref_into()),
2336 syn::Pat::TupleStruct(_0) => Pat::TupleStruct((*_0).ref_into()),
2337 syn::Pat::Type(_0) => Pat::Type((*_0).ref_into()),
2338 syn::Pat::Verbatim(_0) => Pat::Verbatim((*_0).ref_into()),
2339 syn::Pat::Wild(_0) => Pat::Wild((*_0).ref_into()),
2340 _ => unreachable!(),
2341 }
2342 }
2343}
2344impl From<&Pat> for syn::Pat {
2345 fn from(node: &Pat) -> Self {
2346 match node {
2347 Pat::Const(_0) => syn::Pat::Const((*_0).ref_into()),
2348 Pat::Ident(_0) => syn::Pat::Ident((*_0).ref_into()),
2349 Pat::Lit(_0) => syn::Pat::Lit((*_0).ref_into()),
2350 Pat::Macro(_0) => syn::Pat::Macro((*_0).ref_into()),
2351 Pat::Or(_0) => syn::Pat::Or((*_0).ref_into()),
2352 Pat::Paren(_0) => syn::Pat::Paren((*_0).ref_into()),
2353 Pat::Path(_0) => syn::Pat::Path((*_0).ref_into()),
2354 Pat::Range(_0) => syn::Pat::Range((*_0).ref_into()),
2355 Pat::Reference(_0) => syn::Pat::Reference((*_0).ref_into()),
2356 Pat::Rest(_0) => syn::Pat::Rest((*_0).ref_into()),
2357 Pat::Slice(_0) => syn::Pat::Slice((*_0).ref_into()),
2358 Pat::Struct(_0) => syn::Pat::Struct((*_0).ref_into()),
2359 Pat::Tuple(_0) => syn::Pat::Tuple((*_0).ref_into()),
2360 Pat::TupleStruct(_0) => syn::Pat::TupleStruct((*_0).ref_into()),
2361 Pat::Type(_0) => syn::Pat::Type((*_0).ref_into()),
2362 Pat::Verbatim(_0) => syn::Pat::Verbatim((*_0).ref_into()),
2363 Pat::Wild(_0) => syn::Pat::Wild((*_0).ref_into()),
2364 }
2365 }
2366}
2367syn_trait_impl!(syn::PatIdent);
2368impl From<&syn::PatIdent> for PatIdent {
2369 fn from(node: &syn::PatIdent) -> Self {
2370 Self {
2371 attrs: node.attrs.map_into(),
2372 by_ref: node.by_ref.is_some(),
2373 mutability: node.mutability.is_some(),
2374 ident: node.ident.ref_into(),
2375 subpat: node.subpat.ref_map(|(_0, _1)| (*_1).map_into()),
2376 }
2377 }
2378}
2379impl From<&PatIdent> for syn::PatIdent {
2380 fn from(node: &PatIdent) -> Self {
2381 Self {
2382 attrs: node.attrs.map_into(),
2383 by_ref: default_or_none(node.by_ref),
2384 mutability: default_or_none(node.mutability),
2385 ident: node.ident.ref_into(),
2386 subpat: node.subpat.ref_map(|_1| (default(), (*_1).map_into())),
2387 }
2388 }
2389}
2390syn_trait_impl!(syn::PatOr);
2391impl From<&syn::PatOr> for PatOr {
2392 fn from(node: &syn::PatOr) -> Self {
2393 Self {
2394 attrs: node.attrs.map_into(),
2395 leading_vert: node.leading_vert.is_some(),
2396 cases: node.cases.map_into(),
2397 }
2398 }
2399}
2400impl From<&PatOr> for syn::PatOr {
2401 fn from(node: &PatOr) -> Self {
2402 Self {
2403 attrs: node.attrs.map_into(),
2404 leading_vert: default_or_none(node.leading_vert),
2405 cases: node.cases.map_into(),
2406 }
2407 }
2408}
2409syn_trait_impl!(syn::PatParen);
2410impl From<&syn::PatParen> for PatParen {
2411 fn from(node: &syn::PatParen) -> Self {
2412 Self {
2413 attrs: node.attrs.map_into(),
2414 pat: node.pat.map_into(),
2415 }
2416 }
2417}
2418impl From<&PatParen> for syn::PatParen {
2419 fn from(node: &PatParen) -> Self {
2420 Self {
2421 attrs: node.attrs.map_into(),
2422 paren_token: default(),
2423 pat: node.pat.map_into(),
2424 }
2425 }
2426}
2427syn_trait_impl!(syn::PatReference);
2428impl From<&syn::PatReference> for PatReference {
2429 fn from(node: &syn::PatReference) -> Self {
2430 Self {
2431 attrs: node.attrs.map_into(),
2432 mutability: node.mutability.is_some(),
2433 pat: node.pat.map_into(),
2434 }
2435 }
2436}
2437impl From<&PatReference> for syn::PatReference {
2438 fn from(node: &PatReference) -> Self {
2439 Self {
2440 attrs: node.attrs.map_into(),
2441 and_token: default(),
2442 mutability: default_or_none(node.mutability),
2443 pat: node.pat.map_into(),
2444 }
2445 }
2446}
2447syn_trait_impl!(syn::PatRest);
2448impl From<&syn::PatRest> for PatRest {
2449 fn from(node: &syn::PatRest) -> Self {
2450 Self {
2451 attrs: node.attrs.map_into(),
2452 }
2453 }
2454}
2455impl From<&PatRest> for syn::PatRest {
2456 fn from(node: &PatRest) -> Self {
2457 Self {
2458 attrs: node.attrs.map_into(),
2459 dot2_token: default(),
2460 }
2461 }
2462}
2463syn_trait_impl!(syn::PatSlice);
2464impl From<&syn::PatSlice> for PatSlice {
2465 fn from(node: &syn::PatSlice) -> Self {
2466 Self {
2467 attrs: node.attrs.map_into(),
2468 elems: node.elems.map_into(),
2469 }
2470 }
2471}
2472impl From<&PatSlice> for syn::PatSlice {
2473 fn from(node: &PatSlice) -> Self {
2474 Self {
2475 attrs: node.attrs.map_into(),
2476 bracket_token: default(),
2477 elems: node.elems.map_into(),
2478 }
2479 }
2480}
2481syn_trait_impl!(syn::PatStruct);
2482impl From<&syn::PatStruct> for PatStruct {
2483 fn from(node: &syn::PatStruct) -> Self {
2484 Self {
2485 attrs: node.attrs.map_into(),
2486 qself: node.qself.map_into(),
2487 path: node.path.ref_into(),
2488 fields: node.fields.map_into(),
2489 rest: node.rest.map_into(),
2490 }
2491 }
2492}
2493impl From<&PatStruct> for syn::PatStruct {
2494 fn from(node: &PatStruct) -> Self {
2495 Self {
2496 attrs: node.attrs.map_into(),
2497 qself: node.qself.map_into(),
2498 path: node.path.ref_into(),
2499 brace_token: default(),
2500 fields: node.fields.map_into(),
2501 rest: node.rest.map_into(),
2502 }
2503 }
2504}
2505syn_trait_impl!(syn::PatTuple);
2506impl From<&syn::PatTuple> for PatTuple {
2507 fn from(node: &syn::PatTuple) -> Self {
2508 Self {
2509 attrs: node.attrs.map_into(),
2510 elems: node.elems.map_into(),
2511 }
2512 }
2513}
2514impl From<&PatTuple> for syn::PatTuple {
2515 fn from(node: &PatTuple) -> Self {
2516 Self {
2517 attrs: node.attrs.map_into(),
2518 paren_token: default(),
2519 elems: node.elems.map_into(),
2520 }
2521 }
2522}
2523syn_trait_impl!(syn::PatTupleStruct);
2524impl From<&syn::PatTupleStruct> for PatTupleStruct {
2525 fn from(node: &syn::PatTupleStruct) -> Self {
2526 Self {
2527 attrs: node.attrs.map_into(),
2528 qself: node.qself.map_into(),
2529 path: node.path.ref_into(),
2530 elems: node.elems.map_into(),
2531 }
2532 }
2533}
2534impl From<&PatTupleStruct> for syn::PatTupleStruct {
2535 fn from(node: &PatTupleStruct) -> Self {
2536 Self {
2537 attrs: node.attrs.map_into(),
2538 qself: node.qself.map_into(),
2539 path: node.path.ref_into(),
2540 paren_token: default(),
2541 elems: node.elems.map_into(),
2542 }
2543 }
2544}
2545syn_trait_impl!(syn::PatType);
2546impl From<&syn::PatType> for PatType {
2547 fn from(node: &syn::PatType) -> Self {
2548 Self {
2549 attrs: node.attrs.map_into(),
2550 pat: node.pat.map_into(),
2551 ty: node.ty.map_into(),
2552 }
2553 }
2554}
2555impl From<&PatType> for syn::PatType {
2556 fn from(node: &PatType) -> Self {
2557 Self {
2558 attrs: node.attrs.map_into(),
2559 pat: node.pat.map_into(),
2560 colon_token: default(),
2561 ty: node.ty.map_into(),
2562 }
2563 }
2564}
2565syn_trait_impl!(syn::PatWild);
2566impl From<&syn::PatWild> for PatWild {
2567 fn from(node: &syn::PatWild) -> Self {
2568 Self {
2569 attrs: node.attrs.map_into(),
2570 }
2571 }
2572}
2573impl From<&PatWild> for syn::PatWild {
2574 fn from(node: &PatWild) -> Self {
2575 Self {
2576 attrs: node.attrs.map_into(),
2577 underscore_token: default(),
2578 }
2579 }
2580}
2581syn_trait_impl!(syn::Path);
2582impl From<&syn::Path> for Path {
2583 fn from(node: &syn::Path) -> Self {
2584 Self {
2585 leading_colon: node.leading_colon.is_some(),
2586 segments: node.segments.map_into(),
2587 }
2588 }
2589}
2590impl From<&Path> for syn::Path {
2591 fn from(node: &Path) -> Self {
2592 Self {
2593 leading_colon: default_or_none(node.leading_colon),
2594 segments: node.segments.map_into(),
2595 }
2596 }
2597}
2598syn_trait_impl!(syn::PathArguments);
2599impl From<&syn::PathArguments> for PathArguments {
2600 fn from(node: &syn::PathArguments) -> Self {
2601 match node {
2602 syn::PathArguments::None => PathArguments::None,
2603 syn::PathArguments::AngleBracketed(_0) => {
2604 PathArguments::AngleBracketed((*_0).ref_into())
2605 }
2606 syn::PathArguments::Parenthesized(_0) => {
2607 PathArguments::Parenthesized((*_0).ref_into())
2608 }
2609 }
2610 }
2611}
2612impl From<&PathArguments> for syn::PathArguments {
2613 fn from(node: &PathArguments) -> Self {
2614 match node {
2615 PathArguments::None => syn::PathArguments::None,
2616 PathArguments::AngleBracketed(_0) => {
2617 syn::PathArguments::AngleBracketed((*_0).ref_into())
2618 }
2619 PathArguments::Parenthesized(_0) => {
2620 syn::PathArguments::Parenthesized((*_0).ref_into())
2621 }
2622 }
2623 }
2624}
2625syn_trait_impl!(syn::PathSegment);
2626impl From<&syn::PathSegment> for PathSegment {
2627 fn from(node: &syn::PathSegment) -> Self {
2628 Self {
2629 ident: node.ident.ref_into(),
2630 arguments: node.arguments.ref_into(),
2631 }
2632 }
2633}
2634impl From<&PathSegment> for syn::PathSegment {
2635 fn from(node: &PathSegment) -> Self {
2636 Self {
2637 ident: node.ident.ref_into(),
2638 arguments: node.arguments.ref_into(),
2639 }
2640 }
2641}
2642syn_trait_impl!(syn::PredicateLifetime);
2643impl From<&syn::PredicateLifetime> for PredicateLifetime {
2644 fn from(node: &syn::PredicateLifetime) -> Self {
2645 Self {
2646 lifetime: node.lifetime.ref_into(),
2647 bounds: node.bounds.map_into(),
2648 }
2649 }
2650}
2651impl From<&PredicateLifetime> for syn::PredicateLifetime {
2652 fn from(node: &PredicateLifetime) -> Self {
2653 Self {
2654 lifetime: node.lifetime.ref_into(),
2655 colon_token: default(),
2656 bounds: node.bounds.map_into(),
2657 }
2658 }
2659}
2660syn_trait_impl!(syn::PredicateType);
2661impl From<&syn::PredicateType> for PredicateType {
2662 fn from(node: &syn::PredicateType) -> Self {
2663 Self {
2664 lifetimes: node.lifetimes.map_into(),
2665 bounded_ty: node.bounded_ty.ref_into(),
2666 bounds: node.bounds.map_into(),
2667 }
2668 }
2669}
2670impl From<&PredicateType> for syn::PredicateType {
2671 fn from(node: &PredicateType) -> Self {
2672 Self {
2673 lifetimes: node.lifetimes.map_into(),
2674 bounded_ty: node.bounded_ty.ref_into(),
2675 colon_token: default(),
2676 bounds: node.bounds.map_into(),
2677 }
2678 }
2679}
2680syn_trait_impl!(syn::QSelf);
2681impl From<&syn::QSelf> for QSelf {
2682 fn from(node: &syn::QSelf) -> Self {
2683 Self {
2684 ty: node.ty.map_into(),
2685 position: node.position,
2686 as_token: node.as_token.is_some(),
2687 }
2688 }
2689}
2690impl From<&QSelf> for syn::QSelf {
2691 fn from(node: &QSelf) -> Self {
2692 Self {
2693 lt_token: default(),
2694 ty: node.ty.map_into(),
2695 position: node.position,
2696 as_token: default_or_none(node.as_token),
2697 gt_token: default(),
2698 }
2699 }
2700}
2701syn_trait_impl!(syn::RangeLimits);
2702impl From<&syn::RangeLimits> for RangeLimits {
2703 fn from(node: &syn::RangeLimits) -> Self {
2704 match node {
2705 syn::RangeLimits::HalfOpen(..) => RangeLimits::HalfOpen,
2706 syn::RangeLimits::Closed(..) => RangeLimits::Closed,
2707 }
2708 }
2709}
2710impl From<&RangeLimits> for syn::RangeLimits {
2711 fn from(node: &RangeLimits) -> Self {
2712 match node {
2713 RangeLimits::HalfOpen => syn::RangeLimits::HalfOpen(default()),
2714 RangeLimits::Closed => syn::RangeLimits::Closed(default()),
2715 }
2716 }
2717}
2718syn_trait_impl!(syn::Signature);
2719impl From<&syn::Signature> for Signature {
2720 fn from(node: &syn::Signature) -> Self {
2721 Self {
2722 constness: node.constness.is_some(),
2723 asyncness: node.asyncness.is_some(),
2724 unsafety: node.unsafety.is_some(),
2725 abi: node.abi.map_into(),
2726 ident: node.ident.ref_into(),
2727 generics: node.generics.ref_into(),
2728 inputs: node.inputs.map_into(),
2729 variadic: node.variadic.map_into(),
2730 output: node.output.ref_into(),
2731 }
2732 }
2733}
2734impl From<&Signature> for syn::Signature {
2735 fn from(node: &Signature) -> Self {
2736 Self {
2737 constness: default_or_none(node.constness),
2738 asyncness: default_or_none(node.asyncness),
2739 unsafety: default_or_none(node.unsafety),
2740 abi: node.abi.map_into(),
2741 fn_token: default(),
2742 ident: node.ident.ref_into(),
2743 generics: node.generics.ref_into(),
2744 paren_token: default(),
2745 inputs: node.inputs.map_into(),
2746 variadic: node.variadic.map_into(),
2747 output: node.output.ref_into(),
2748 }
2749 }
2750}
2751syn_trait_impl!(syn::StaticMutability);
2752impl From<&syn::StaticMutability> for StaticMutability {
2753 fn from(node: &syn::StaticMutability) -> Self {
2754 match node {
2755 syn::StaticMutability::Mut(..) => StaticMutability::Mut,
2756 syn::StaticMutability::None => StaticMutability::None,
2757 _ => unreachable!(),
2758 }
2759 }
2760}
2761impl From<&StaticMutability> for syn::StaticMutability {
2762 fn from(node: &StaticMutability) -> Self {
2763 match node {
2764 StaticMutability::Mut => syn::StaticMutability::Mut(default()),
2765 StaticMutability::None => syn::StaticMutability::None,
2766 }
2767 }
2768}
2769syn_trait_impl!(syn::Stmt);
2770impl From<&syn::Stmt> for Stmt {
2771 fn from(node: &syn::Stmt) -> Self {
2772 match node {
2773 syn::Stmt::Local(_0) => Stmt::Local((*_0).ref_into()),
2774 syn::Stmt::Item(_0) => Stmt::Item((*_0).ref_into()),
2775 syn::Stmt::Expr(_0, _1) => Stmt::Expr((*_0).ref_into(), (*_1).is_some()),
2776 syn::Stmt::Macro(_0) => Stmt::Macro((*_0).ref_into()),
2777 }
2778 }
2779}
2780impl From<&Stmt> for syn::Stmt {
2781 fn from(node: &Stmt) -> Self {
2782 match node {
2783 Stmt::Local(_0) => syn::Stmt::Local((*_0).ref_into()),
2784 Stmt::Item(_0) => syn::Stmt::Item((*_0).ref_into()),
2785 Stmt::Expr(_0, _1) => {
2786 syn::Stmt::Expr((*_0).ref_into(), default_or_none((*_1)))
2787 }
2788 Stmt::Macro(_0) => syn::Stmt::Macro((*_0).ref_into()),
2789 }
2790 }
2791}
2792syn_trait_impl!(syn::StmtMacro);
2793impl From<&syn::StmtMacro> for StmtMacro {
2794 fn from(node: &syn::StmtMacro) -> Self {
2795 Self {
2796 attrs: node.attrs.map_into(),
2797 mac: node.mac.ref_into(),
2798 semi_token: node.semi_token.is_some(),
2799 }
2800 }
2801}
2802impl From<&StmtMacro> for syn::StmtMacro {
2803 fn from(node: &StmtMacro) -> Self {
2804 Self {
2805 attrs: node.attrs.map_into(),
2806 mac: node.mac.ref_into(),
2807 semi_token: default_or_none(node.semi_token),
2808 }
2809 }
2810}
2811syn_trait_impl!(syn::TraitBound);
2812impl From<&syn::TraitBound> for TraitBound {
2813 fn from(node: &syn::TraitBound) -> Self {
2814 Self {
2815 paren_token: node.paren_token.is_some(),
2816 modifier: node.modifier.ref_into(),
2817 lifetimes: node.lifetimes.map_into(),
2818 path: node.path.ref_into(),
2819 }
2820 }
2821}
2822impl From<&TraitBound> for syn::TraitBound {
2823 fn from(node: &TraitBound) -> Self {
2824 Self {
2825 paren_token: default_or_none(node.paren_token),
2826 modifier: node.modifier.ref_into(),
2827 lifetimes: node.lifetimes.map_into(),
2828 path: node.path.ref_into(),
2829 }
2830 }
2831}
2832syn_trait_impl!(syn::TraitBoundModifier);
2833impl From<&syn::TraitBoundModifier> for TraitBoundModifier {
2834 fn from(node: &syn::TraitBoundModifier) -> Self {
2835 match node {
2836 syn::TraitBoundModifier::None => TraitBoundModifier::None,
2837 syn::TraitBoundModifier::Maybe(..) => TraitBoundModifier::Maybe,
2838 }
2839 }
2840}
2841impl From<&TraitBoundModifier> for syn::TraitBoundModifier {
2842 fn from(node: &TraitBoundModifier) -> Self {
2843 match node {
2844 TraitBoundModifier::None => syn::TraitBoundModifier::None,
2845 TraitBoundModifier::Maybe => syn::TraitBoundModifier::Maybe(default()),
2846 }
2847 }
2848}
2849syn_trait_impl!(syn::TraitItem);
2850impl From<&syn::TraitItem> for TraitItem {
2851 fn from(node: &syn::TraitItem) -> Self {
2852 match node {
2853 syn::TraitItem::Const(_0) => TraitItem::Const((*_0).ref_into()),
2854 syn::TraitItem::Fn(_0) => TraitItem::Fn((*_0).ref_into()),
2855 syn::TraitItem::Type(_0) => TraitItem::Type((*_0).ref_into()),
2856 syn::TraitItem::Macro(_0) => TraitItem::Macro((*_0).ref_into()),
2857 syn::TraitItem::Verbatim(_0) => TraitItem::Verbatim((*_0).ref_into()),
2858 _ => unreachable!(),
2859 }
2860 }
2861}
2862impl From<&TraitItem> for syn::TraitItem {
2863 fn from(node: &TraitItem) -> Self {
2864 match node {
2865 TraitItem::Const(_0) => syn::TraitItem::Const((*_0).ref_into()),
2866 TraitItem::Fn(_0) => syn::TraitItem::Fn((*_0).ref_into()),
2867 TraitItem::Type(_0) => syn::TraitItem::Type((*_0).ref_into()),
2868 TraitItem::Macro(_0) => syn::TraitItem::Macro((*_0).ref_into()),
2869 TraitItem::Verbatim(_0) => syn::TraitItem::Verbatim((*_0).ref_into()),
2870 }
2871 }
2872}
2873syn_trait_impl!(syn::TraitItemConst);
2874impl From<&syn::TraitItemConst> for TraitItemConst {
2875 fn from(node: &syn::TraitItemConst) -> Self {
2876 Self {
2877 attrs: node.attrs.map_into(),
2878 ident: node.ident.ref_into(),
2879 generics: node.generics.ref_into(),
2880 ty: node.ty.ref_into(),
2881 default: node.default.ref_map(|(_0, _1)| (*_1).ref_into()),
2882 }
2883 }
2884}
2885impl From<&TraitItemConst> for syn::TraitItemConst {
2886 fn from(node: &TraitItemConst) -> Self {
2887 Self {
2888 attrs: node.attrs.map_into(),
2889 const_token: default(),
2890 ident: node.ident.ref_into(),
2891 generics: node.generics.ref_into(),
2892 colon_token: default(),
2893 ty: node.ty.ref_into(),
2894 default: node.default.ref_map(|_1| (default(), (*_1).ref_into())),
2895 semi_token: default(),
2896 }
2897 }
2898}
2899syn_trait_impl!(syn::TraitItemMacro);
2900impl From<&syn::TraitItemMacro> for TraitItemMacro {
2901 fn from(node: &syn::TraitItemMacro) -> Self {
2902 Self {
2903 attrs: node.attrs.map_into(),
2904 mac: node.mac.ref_into(),
2905 semi_token: node.semi_token.is_some(),
2906 }
2907 }
2908}
2909impl From<&TraitItemMacro> for syn::TraitItemMacro {
2910 fn from(node: &TraitItemMacro) -> Self {
2911 Self {
2912 attrs: node.attrs.map_into(),
2913 mac: node.mac.ref_into(),
2914 semi_token: default_or_none(node.semi_token),
2915 }
2916 }
2917}
2918syn_trait_impl!(syn::TraitItemType);
2919impl From<&syn::TraitItemType> for TraitItemType {
2920 fn from(node: &syn::TraitItemType) -> Self {
2921 Self {
2922 attrs: node.attrs.map_into(),
2923 ident: node.ident.ref_into(),
2924 generics: node.generics.ref_into(),
2925 colon_token: node.colon_token.is_some(),
2926 bounds: node.bounds.map_into(),
2927 default: node.default.ref_map(|(_0, _1)| (*_1).ref_into()),
2928 }
2929 }
2930}
2931impl From<&TraitItemType> for syn::TraitItemType {
2932 fn from(node: &TraitItemType) -> Self {
2933 Self {
2934 attrs: node.attrs.map_into(),
2935 type_token: default(),
2936 ident: node.ident.ref_into(),
2937 generics: node.generics.ref_into(),
2938 colon_token: default_or_none(node.colon_token),
2939 bounds: node.bounds.map_into(),
2940 default: node.default.ref_map(|_1| (default(), (*_1).ref_into())),
2941 semi_token: default(),
2942 }
2943 }
2944}
2945syn_trait_impl!(syn::Type);
2946impl From<&syn::Type> for Type {
2947 fn from(node: &syn::Type) -> Self {
2948 match node {
2949 syn::Type::Array(_0) => Type::Array((*_0).ref_into()),
2950 syn::Type::BareFn(_0) => Type::BareFn((*_0).ref_into()),
2951 syn::Type::Group(_0) => Type::Group((*_0).ref_into()),
2952 syn::Type::ImplTrait(_0) => Type::ImplTrait((*_0).ref_into()),
2953 syn::Type::Infer(..) => Type::Infer,
2954 syn::Type::Macro(_0) => Type::Macro((*_0).ref_into()),
2955 syn::Type::Never(..) => Type::Never,
2956 syn::Type::Paren(_0) => Type::Paren((*_0).ref_into()),
2957 syn::Type::Path(_0) => Type::Path((*_0).ref_into()),
2958 syn::Type::Ptr(_0) => Type::Ptr((*_0).ref_into()),
2959 syn::Type::Reference(_0) => Type::Reference((*_0).ref_into()),
2960 syn::Type::Slice(_0) => Type::Slice((*_0).ref_into()),
2961 syn::Type::TraitObject(_0) => Type::TraitObject((*_0).ref_into()),
2962 syn::Type::Tuple(_0) => Type::Tuple((*_0).ref_into()),
2963 syn::Type::Verbatim(_0) => Type::Verbatim((*_0).ref_into()),
2964 _ => unreachable!(),
2965 }
2966 }
2967}
2968impl From<&Type> for syn::Type {
2969 fn from(node: &Type) -> Self {
2970 match node {
2971 Type::Array(_0) => syn::Type::Array((*_0).ref_into()),
2972 Type::BareFn(_0) => syn::Type::BareFn((*_0).ref_into()),
2973 Type::Group(_0) => syn::Type::Group((*_0).ref_into()),
2974 Type::ImplTrait(_0) => syn::Type::ImplTrait((*_0).ref_into()),
2975 Type::Infer => {
2976 syn::Type::Infer(syn::TypeInfer {
2977 underscore_token: default(),
2978 })
2979 }
2980 Type::Macro(_0) => syn::Type::Macro((*_0).ref_into()),
2981 Type::Never => {
2982 syn::Type::Never(syn::TypeNever {
2983 bang_token: default(),
2984 })
2985 }
2986 Type::Paren(_0) => syn::Type::Paren((*_0).ref_into()),
2987 Type::Path(_0) => syn::Type::Path((*_0).ref_into()),
2988 Type::Ptr(_0) => syn::Type::Ptr((*_0).ref_into()),
2989 Type::Reference(_0) => syn::Type::Reference((*_0).ref_into()),
2990 Type::Slice(_0) => syn::Type::Slice((*_0).ref_into()),
2991 Type::TraitObject(_0) => syn::Type::TraitObject((*_0).ref_into()),
2992 Type::Tuple(_0) => syn::Type::Tuple((*_0).ref_into()),
2993 Type::Verbatim(_0) => syn::Type::Verbatim((*_0).ref_into()),
2994 }
2995 }
2996}
2997syn_trait_impl!(syn::TypeArray);
2998impl From<&syn::TypeArray> for TypeArray {
2999 fn from(node: &syn::TypeArray) -> Self {
3000 Self {
3001 elem: node.elem.map_into(),
3002 len: node.len.ref_into(),
3003 }
3004 }
3005}
3006impl From<&TypeArray> for syn::TypeArray {
3007 fn from(node: &TypeArray) -> Self {
3008 Self {
3009 bracket_token: default(),
3010 elem: node.elem.map_into(),
3011 semi_token: default(),
3012 len: node.len.ref_into(),
3013 }
3014 }
3015}
3016syn_trait_impl!(syn::TypeBareFn);
3017impl From<&syn::TypeBareFn> for TypeBareFn {
3018 fn from(node: &syn::TypeBareFn) -> Self {
3019 Self {
3020 lifetimes: node.lifetimes.map_into(),
3021 unsafety: node.unsafety.is_some(),
3022 abi: node.abi.map_into(),
3023 inputs: node.inputs.map_into(),
3024 variadic: node.variadic.map_into(),
3025 output: node.output.ref_into(),
3026 }
3027 }
3028}
3029impl From<&TypeBareFn> for syn::TypeBareFn {
3030 fn from(node: &TypeBareFn) -> Self {
3031 Self {
3032 lifetimes: node.lifetimes.map_into(),
3033 unsafety: default_or_none(node.unsafety),
3034 abi: node.abi.map_into(),
3035 fn_token: default(),
3036 paren_token: default(),
3037 inputs: node.inputs.map_into(),
3038 variadic: node.variadic.map_into(),
3039 output: node.output.ref_into(),
3040 }
3041 }
3042}
3043syn_trait_impl!(syn::TypeGroup);
3044impl From<&syn::TypeGroup> for TypeGroup {
3045 fn from(node: &syn::TypeGroup) -> Self {
3046 Self { elem: node.elem.map_into() }
3047 }
3048}
3049impl From<&TypeGroup> for syn::TypeGroup {
3050 fn from(node: &TypeGroup) -> Self {
3051 Self {
3052 group_token: default(),
3053 elem: node.elem.map_into(),
3054 }
3055 }
3056}
3057syn_trait_impl!(syn::TypeImplTrait);
3058impl From<&syn::TypeImplTrait> for TypeImplTrait {
3059 fn from(node: &syn::TypeImplTrait) -> Self {
3060 Self {
3061 bounds: node.bounds.map_into(),
3062 }
3063 }
3064}
3065impl From<&TypeImplTrait> for syn::TypeImplTrait {
3066 fn from(node: &TypeImplTrait) -> Self {
3067 Self {
3068 impl_token: default(),
3069 bounds: node.bounds.map_into(),
3070 }
3071 }
3072}
3073syn_trait_impl!(syn::TypeMacro);
3074impl From<&syn::TypeMacro> for TypeMacro {
3075 fn from(node: &syn::TypeMacro) -> Self {
3076 Self { mac: node.mac.ref_into() }
3077 }
3078}
3079impl From<&TypeMacro> for syn::TypeMacro {
3080 fn from(node: &TypeMacro) -> Self {
3081 Self { mac: node.mac.ref_into() }
3082 }
3083}
3084syn_trait_impl!(syn::TypeParam);
3085impl From<&syn::TypeParam> for TypeParam {
3086 fn from(node: &syn::TypeParam) -> Self {
3087 Self {
3088 attrs: node.attrs.map_into(),
3089 ident: node.ident.ref_into(),
3090 colon_token: node.colon_token.is_some(),
3091 bounds: node.bounds.map_into(),
3092 eq_token: node.eq_token.is_some(),
3093 default: node.default.map_into(),
3094 }
3095 }
3096}
3097impl From<&TypeParam> for syn::TypeParam {
3098 fn from(node: &TypeParam) -> Self {
3099 Self {
3100 attrs: node.attrs.map_into(),
3101 ident: node.ident.ref_into(),
3102 colon_token: default_or_none(node.colon_token),
3103 bounds: node.bounds.map_into(),
3104 eq_token: default_or_none(node.eq_token),
3105 default: node.default.map_into(),
3106 }
3107 }
3108}
3109syn_trait_impl!(syn::TypeParamBound);
3110impl From<&syn::TypeParamBound> for TypeParamBound {
3111 fn from(node: &syn::TypeParamBound) -> Self {
3112 match node {
3113 syn::TypeParamBound::Trait(_0) => TypeParamBound::Trait((*_0).ref_into()),
3114 syn::TypeParamBound::Lifetime(_0) => {
3115 TypeParamBound::Lifetime((*_0).ref_into())
3116 }
3117 syn::TypeParamBound::Verbatim(_0) => {
3118 TypeParamBound::Verbatim((*_0).ref_into())
3119 }
3120 _ => unreachable!(),
3121 }
3122 }
3123}
3124impl From<&TypeParamBound> for syn::TypeParamBound {
3125 fn from(node: &TypeParamBound) -> Self {
3126 match node {
3127 TypeParamBound::Trait(_0) => syn::TypeParamBound::Trait((*_0).ref_into()),
3128 TypeParamBound::Lifetime(_0) => {
3129 syn::TypeParamBound::Lifetime((*_0).ref_into())
3130 }
3131 TypeParamBound::Verbatim(_0) => {
3132 syn::TypeParamBound::Verbatim((*_0).ref_into())
3133 }
3134 }
3135 }
3136}
3137syn_trait_impl!(syn::TypeParen);
3138impl From<&syn::TypeParen> for TypeParen {
3139 fn from(node: &syn::TypeParen) -> Self {
3140 Self { elem: node.elem.map_into() }
3141 }
3142}
3143impl From<&TypeParen> for syn::TypeParen {
3144 fn from(node: &TypeParen) -> Self {
3145 Self {
3146 paren_token: default(),
3147 elem: node.elem.map_into(),
3148 }
3149 }
3150}
3151syn_trait_impl!(syn::TypePath);
3152impl From<&syn::TypePath> for TypePath {
3153 fn from(node: &syn::TypePath) -> Self {
3154 Self {
3155 qself: node.qself.map_into(),
3156 path: node.path.ref_into(),
3157 }
3158 }
3159}
3160impl From<&TypePath> for syn::TypePath {
3161 fn from(node: &TypePath) -> Self {
3162 Self {
3163 qself: node.qself.map_into(),
3164 path: node.path.ref_into(),
3165 }
3166 }
3167}
3168syn_trait_impl!(syn::TypePtr);
3169impl From<&syn::TypePtr> for TypePtr {
3170 fn from(node: &syn::TypePtr) -> Self {
3171 Self {
3172 const_token: node.const_token.is_some(),
3173 mutability: node.mutability.is_some(),
3174 elem: node.elem.map_into(),
3175 }
3176 }
3177}
3178impl From<&TypePtr> for syn::TypePtr {
3179 fn from(node: &TypePtr) -> Self {
3180 Self {
3181 star_token: default(),
3182 const_token: default_or_none(node.const_token),
3183 mutability: default_or_none(node.mutability),
3184 elem: node.elem.map_into(),
3185 }
3186 }
3187}
3188syn_trait_impl!(syn::TypeReference);
3189impl From<&syn::TypeReference> for TypeReference {
3190 fn from(node: &syn::TypeReference) -> Self {
3191 Self {
3192 lifetime: node.lifetime.map_into(),
3193 mutability: node.mutability.is_some(),
3194 elem: node.elem.map_into(),
3195 }
3196 }
3197}
3198impl From<&TypeReference> for syn::TypeReference {
3199 fn from(node: &TypeReference) -> Self {
3200 Self {
3201 and_token: default(),
3202 lifetime: node.lifetime.map_into(),
3203 mutability: default_or_none(node.mutability),
3204 elem: node.elem.map_into(),
3205 }
3206 }
3207}
3208syn_trait_impl!(syn::TypeSlice);
3209impl From<&syn::TypeSlice> for TypeSlice {
3210 fn from(node: &syn::TypeSlice) -> Self {
3211 Self { elem: node.elem.map_into() }
3212 }
3213}
3214impl From<&TypeSlice> for syn::TypeSlice {
3215 fn from(node: &TypeSlice) -> Self {
3216 Self {
3217 bracket_token: default(),
3218 elem: node.elem.map_into(),
3219 }
3220 }
3221}
3222syn_trait_impl!(syn::TypeTraitObject);
3223impl From<&syn::TypeTraitObject> for TypeTraitObject {
3224 fn from(node: &syn::TypeTraitObject) -> Self {
3225 Self {
3226 dyn_token: node.dyn_token.is_some(),
3227 bounds: node.bounds.map_into(),
3228 }
3229 }
3230}
3231impl From<&TypeTraitObject> for syn::TypeTraitObject {
3232 fn from(node: &TypeTraitObject) -> Self {
3233 Self {
3234 dyn_token: default_or_none(node.dyn_token),
3235 bounds: node.bounds.map_into(),
3236 }
3237 }
3238}
3239syn_trait_impl!(syn::TypeTuple);
3240impl From<&syn::TypeTuple> for TypeTuple {
3241 fn from(node: &syn::TypeTuple) -> Self {
3242 Self {
3243 elems: node.elems.map_into(),
3244 }
3245 }
3246}
3247impl From<&TypeTuple> for syn::TypeTuple {
3248 fn from(node: &TypeTuple) -> Self {
3249 Self {
3250 paren_token: default(),
3251 elems: node.elems.map_into(),
3252 }
3253 }
3254}
3255syn_trait_impl!(syn::UnOp);
3256impl From<&syn::UnOp> for UnOp {
3257 fn from(node: &syn::UnOp) -> Self {
3258 match node {
3259 syn::UnOp::Deref(..) => UnOp::Deref,
3260 syn::UnOp::Not(..) => UnOp::Not,
3261 syn::UnOp::Neg(..) => UnOp::Neg,
3262 _ => unreachable!(),
3263 }
3264 }
3265}
3266impl From<&UnOp> for syn::UnOp {
3267 fn from(node: &UnOp) -> Self {
3268 match node {
3269 UnOp::Deref => syn::UnOp::Deref(default()),
3270 UnOp::Not => syn::UnOp::Not(default()),
3271 UnOp::Neg => syn::UnOp::Neg(default()),
3272 }
3273 }
3274}
3275syn_trait_impl!(syn::UseGroup);
3276impl From<&syn::UseGroup> for UseGroup {
3277 fn from(node: &syn::UseGroup) -> Self {
3278 Self {
3279 items: node.items.map_into(),
3280 }
3281 }
3282}
3283impl From<&UseGroup> for syn::UseGroup {
3284 fn from(node: &UseGroup) -> Self {
3285 Self {
3286 brace_token: default(),
3287 items: node.items.map_into(),
3288 }
3289 }
3290}
3291syn_trait_impl!(syn::UseName);
3292impl From<&syn::UseName> for UseName {
3293 fn from(node: &syn::UseName) -> Self {
3294 Self {
3295 ident: node.ident.ref_into(),
3296 }
3297 }
3298}
3299impl From<&UseName> for syn::UseName {
3300 fn from(node: &UseName) -> Self {
3301 Self {
3302 ident: node.ident.ref_into(),
3303 }
3304 }
3305}
3306syn_trait_impl!(syn::UsePath);
3307impl From<&syn::UsePath> for UsePath {
3308 fn from(node: &syn::UsePath) -> Self {
3309 Self {
3310 ident: node.ident.ref_into(),
3311 tree: node.tree.map_into(),
3312 }
3313 }
3314}
3315impl From<&UsePath> for syn::UsePath {
3316 fn from(node: &UsePath) -> Self {
3317 Self {
3318 ident: node.ident.ref_into(),
3319 colon2_token: default(),
3320 tree: node.tree.map_into(),
3321 }
3322 }
3323}
3324syn_trait_impl!(syn::UseRename);
3325impl From<&syn::UseRename> for UseRename {
3326 fn from(node: &syn::UseRename) -> Self {
3327 Self {
3328 ident: node.ident.ref_into(),
3329 rename: node.rename.ref_into(),
3330 }
3331 }
3332}
3333impl From<&UseRename> for syn::UseRename {
3334 fn from(node: &UseRename) -> Self {
3335 Self {
3336 ident: node.ident.ref_into(),
3337 as_token: default(),
3338 rename: node.rename.ref_into(),
3339 }
3340 }
3341}
3342syn_trait_impl!(syn::UseTree);
3343impl From<&syn::UseTree> for UseTree {
3344 fn from(node: &syn::UseTree) -> Self {
3345 match node {
3346 syn::UseTree::Path(_0) => UseTree::Path((*_0).ref_into()),
3347 syn::UseTree::Name(_0) => UseTree::Name((*_0).ref_into()),
3348 syn::UseTree::Rename(_0) => UseTree::Rename((*_0).ref_into()),
3349 syn::UseTree::Glob(..) => UseTree::Glob,
3350 syn::UseTree::Group(_0) => UseTree::Group((*_0).ref_into()),
3351 }
3352 }
3353}
3354impl From<&UseTree> for syn::UseTree {
3355 fn from(node: &UseTree) -> Self {
3356 match node {
3357 UseTree::Path(_0) => syn::UseTree::Path((*_0).ref_into()),
3358 UseTree::Name(_0) => syn::UseTree::Name((*_0).ref_into()),
3359 UseTree::Rename(_0) => syn::UseTree::Rename((*_0).ref_into()),
3360 UseTree::Glob => {
3361 syn::UseTree::Glob(syn::UseGlob {
3362 star_token: default(),
3363 })
3364 }
3365 UseTree::Group(_0) => syn::UseTree::Group((*_0).ref_into()),
3366 }
3367 }
3368}
3369syn_trait_impl!(syn::Variadic);
3370impl From<&syn::Variadic> for Variadic {
3371 fn from(node: &syn::Variadic) -> Self {
3372 Self {
3373 attrs: node.attrs.map_into(),
3374 pat: node.pat.ref_map(|(_0, _1)| (*_0).map_into()),
3375 comma: node.comma.is_some(),
3376 }
3377 }
3378}
3379impl From<&Variadic> for syn::Variadic {
3380 fn from(node: &Variadic) -> Self {
3381 Self {
3382 attrs: node.attrs.map_into(),
3383 pat: node.pat.ref_map(|_0| ((*_0).map_into(), default())),
3384 dots: default(),
3385 comma: default_or_none(node.comma),
3386 }
3387 }
3388}
3389syn_trait_impl!(syn::Variant);
3390impl From<&syn::Variant> for Variant {
3391 fn from(node: &syn::Variant) -> Self {
3392 Self {
3393 attrs: node.attrs.map_into(),
3394 ident: node.ident.ref_into(),
3395 fields: node.fields.ref_into(),
3396 discriminant: node.discriminant.ref_map(|(_0, _1)| (*_1).ref_into()),
3397 }
3398 }
3399}
3400impl From<&Variant> for syn::Variant {
3401 fn from(node: &Variant) -> Self {
3402 Self {
3403 attrs: node.attrs.map_into(),
3404 ident: node.ident.ref_into(),
3405 fields: node.fields.ref_into(),
3406 discriminant: node.discriminant.ref_map(|_1| (default(), (*_1).ref_into())),
3407 }
3408 }
3409}
3410syn_trait_impl!(syn::VisRestricted);
3411impl From<&syn::VisRestricted> for VisRestricted {
3412 fn from(node: &syn::VisRestricted) -> Self {
3413 Self {
3414 in_token: node.in_token.is_some(),
3415 path: node.path.map_into(),
3416 }
3417 }
3418}
3419impl From<&VisRestricted> for syn::VisRestricted {
3420 fn from(node: &VisRestricted) -> Self {
3421 Self {
3422 pub_token: default(),
3423 paren_token: default(),
3424 in_token: default_or_none(node.in_token),
3425 path: node.path.map_into(),
3426 }
3427 }
3428}
3429syn_trait_impl!(syn::Visibility);
3430impl From<&syn::Visibility> for Visibility {
3431 fn from(node: &syn::Visibility) -> Self {
3432 match node {
3433 syn::Visibility::Public(..) => Visibility::Public,
3434 syn::Visibility::Restricted(_0) => Visibility::Restricted((*_0).ref_into()),
3435 syn::Visibility::Inherited => Visibility::Inherited,
3436 }
3437 }
3438}
3439impl From<&Visibility> for syn::Visibility {
3440 fn from(node: &Visibility) -> Self {
3441 match node {
3442 Visibility::Public => syn::Visibility::Public(default()),
3443 Visibility::Restricted(_0) => syn::Visibility::Restricted((*_0).ref_into()),
3444 Visibility::Inherited => syn::Visibility::Inherited,
3445 }
3446 }
3447}
3448syn_trait_impl!(syn::WhereClause);
3449impl From<&syn::WhereClause> for WhereClause {
3450 fn from(node: &syn::WhereClause) -> Self {
3451 Self {
3452 predicates: node.predicates.map_into(),
3453 }
3454 }
3455}
3456impl From<&WhereClause> for syn::WhereClause {
3457 fn from(node: &WhereClause) -> Self {
3458 Self {
3459 where_token: default(),
3460 predicates: node.predicates.map_into(),
3461 }
3462 }
3463}
3464syn_trait_impl!(syn::WherePredicate);
3465impl From<&syn::WherePredicate> for WherePredicate {
3466 fn from(node: &syn::WherePredicate) -> Self {
3467 match node {
3468 syn::WherePredicate::Lifetime(_0) => {
3469 WherePredicate::Lifetime((*_0).ref_into())
3470 }
3471 syn::WherePredicate::Type(_0) => WherePredicate::Type((*_0).ref_into()),
3472 _ => unreachable!(),
3473 }
3474 }
3475}
3476impl From<&WherePredicate> for syn::WherePredicate {
3477 fn from(node: &WherePredicate) -> Self {
3478 match node {
3479 WherePredicate::Lifetime(_0) => {
3480 syn::WherePredicate::Lifetime((*_0).ref_into())
3481 }
3482 WherePredicate::Type(_0) => syn::WherePredicate::Type((*_0).ref_into()),
3483 }
3484 }
3485}