aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated/nodes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs4180
1 files changed, 4180 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
new file mode 100644
index 000000000..bcbfd1129
--- /dev/null
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -0,0 +1,4180 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3use super::tokens::*;
4use crate::{
5 ast::{self, support, AstChildren, AstNode},
6 SyntaxKind::{self, *},
7 SyntaxNode,
8};
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct SourceFile {
11 pub(crate) syntax: SyntaxNode,
12}
13impl AstNode for SourceFile {
14 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
15 fn cast(syntax: SyntaxNode) -> Option<Self> {
16 if Self::can_cast(syntax.kind()) {
17 Some(Self { syntax })
18 } else {
19 None
20 }
21 }
22 fn syntax(&self) -> &SyntaxNode { &self.syntax }
23}
24impl ast::ModuleItemOwner for SourceFile {}
25impl ast::FnDefOwner for SourceFile {}
26impl ast::AttrsOwner for SourceFile {}
27impl SourceFile {
28 pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) }
29}
30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
31pub struct FnDef {
32 pub(crate) syntax: SyntaxNode,
33}
34impl AstNode for FnDef {
35 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF }
36 fn cast(syntax: SyntaxNode) -> Option<Self> {
37 if Self::can_cast(syntax.kind()) {
38 Some(Self { syntax })
39 } else {
40 None
41 }
42 }
43 fn syntax(&self) -> &SyntaxNode { &self.syntax }
44}
45impl ast::VisibilityOwner for FnDef {}
46impl ast::NameOwner for FnDef {}
47impl ast::TypeParamsOwner for FnDef {}
48impl ast::DocCommentsOwner for FnDef {}
49impl ast::AttrsOwner for FnDef {}
50impl FnDef {
51 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
52 pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
53 pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
54 pub fn async_kw_token(&self) -> Option<AsyncKw> { support::token(&self.syntax) }
55 pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
56 pub fn fn_kw_token(&self) -> Option<FnKw> { support::token(&self.syntax) }
57 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
58 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
59 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
60 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
61}
62#[derive(Debug, Clone, PartialEq, Eq, Hash)]
63pub struct RetType {
64 pub(crate) syntax: SyntaxNode,
65}
66impl AstNode for RetType {
67 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
68 fn cast(syntax: SyntaxNode) -> Option<Self> {
69 if Self::can_cast(syntax.kind()) {
70 Some(Self { syntax })
71 } else {
72 None
73 }
74 }
75 fn syntax(&self) -> &SyntaxNode { &self.syntax }
76}
77impl RetType {
78 pub fn thin_arrow_token(&self) -> Option<ThinArrow> { support::token(&self.syntax) }
79 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
80}
81#[derive(Debug, Clone, PartialEq, Eq, Hash)]
82pub struct StructDef {
83 pub(crate) syntax: SyntaxNode,
84}
85impl AstNode for StructDef {
86 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF }
87 fn cast(syntax: SyntaxNode) -> Option<Self> {
88 if Self::can_cast(syntax.kind()) {
89 Some(Self { syntax })
90 } else {
91 None
92 }
93 }
94 fn syntax(&self) -> &SyntaxNode { &self.syntax }
95}
96impl ast::VisibilityOwner for StructDef {}
97impl ast::NameOwner for StructDef {}
98impl ast::TypeParamsOwner for StructDef {}
99impl ast::AttrsOwner for StructDef {}
100impl ast::DocCommentsOwner for StructDef {}
101impl StructDef {
102 pub fn struct_kw_token(&self) -> Option<StructKw> { support::token(&self.syntax) }
103 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
104 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
105}
106#[derive(Debug, Clone, PartialEq, Eq, Hash)]
107pub struct UnionDef {
108 pub(crate) syntax: SyntaxNode,
109}
110impl AstNode for UnionDef {
111 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF }
112 fn cast(syntax: SyntaxNode) -> Option<Self> {
113 if Self::can_cast(syntax.kind()) {
114 Some(Self { syntax })
115 } else {
116 None
117 }
118 }
119 fn syntax(&self) -> &SyntaxNode { &self.syntax }
120}
121impl ast::VisibilityOwner for UnionDef {}
122impl ast::NameOwner for UnionDef {}
123impl ast::TypeParamsOwner for UnionDef {}
124impl ast::AttrsOwner for UnionDef {}
125impl ast::DocCommentsOwner for UnionDef {}
126impl UnionDef {
127 pub fn union_kw_token(&self) -> Option<UnionKw> { support::token(&self.syntax) }
128 pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
129 support::child(&self.syntax)
130 }
131}
132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
133pub struct RecordFieldDefList {
134 pub(crate) syntax: SyntaxNode,
135}
136impl AstNode for RecordFieldDefList {
137 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
138 fn cast(syntax: SyntaxNode) -> Option<Self> {
139 if Self::can_cast(syntax.kind()) {
140 Some(Self { syntax })
141 } else {
142 None
143 }
144 }
145 fn syntax(&self) -> &SyntaxNode { &self.syntax }
146}
147impl RecordFieldDefList {
148 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
149 pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) }
150 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
151}
152#[derive(Debug, Clone, PartialEq, Eq, Hash)]
153pub struct RecordFieldDef {
154 pub(crate) syntax: SyntaxNode,
155}
156impl AstNode for RecordFieldDef {
157 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF }
158 fn cast(syntax: SyntaxNode) -> Option<Self> {
159 if Self::can_cast(syntax.kind()) {
160 Some(Self { syntax })
161 } else {
162 None
163 }
164 }
165 fn syntax(&self) -> &SyntaxNode { &self.syntax }
166}
167impl ast::VisibilityOwner for RecordFieldDef {}
168impl ast::NameOwner for RecordFieldDef {}
169impl ast::AttrsOwner for RecordFieldDef {}
170impl ast::DocCommentsOwner for RecordFieldDef {}
171impl ast::TypeAscriptionOwner for RecordFieldDef {}
172impl RecordFieldDef {}
173#[derive(Debug, Clone, PartialEq, Eq, Hash)]
174pub struct TupleFieldDefList {
175 pub(crate) syntax: SyntaxNode,
176}
177impl AstNode for TupleFieldDefList {
178 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST }
179 fn cast(syntax: SyntaxNode) -> Option<Self> {
180 if Self::can_cast(syntax.kind()) {
181 Some(Self { syntax })
182 } else {
183 None
184 }
185 }
186 fn syntax(&self) -> &SyntaxNode { &self.syntax }
187}
188impl TupleFieldDefList {
189 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
190 pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) }
191 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
192}
193#[derive(Debug, Clone, PartialEq, Eq, Hash)]
194pub struct TupleFieldDef {
195 pub(crate) syntax: SyntaxNode,
196}
197impl AstNode for TupleFieldDef {
198 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF }
199 fn cast(syntax: SyntaxNode) -> Option<Self> {
200 if Self::can_cast(syntax.kind()) {
201 Some(Self { syntax })
202 } else {
203 None
204 }
205 }
206 fn syntax(&self) -> &SyntaxNode { &self.syntax }
207}
208impl ast::VisibilityOwner for TupleFieldDef {}
209impl ast::AttrsOwner for TupleFieldDef {}
210impl TupleFieldDef {
211 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
212}
213#[derive(Debug, Clone, PartialEq, Eq, Hash)]
214pub struct EnumDef {
215 pub(crate) syntax: SyntaxNode,
216}
217impl AstNode for EnumDef {
218 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF }
219 fn cast(syntax: SyntaxNode) -> Option<Self> {
220 if Self::can_cast(syntax.kind()) {
221 Some(Self { syntax })
222 } else {
223 None
224 }
225 }
226 fn syntax(&self) -> &SyntaxNode { &self.syntax }
227}
228impl ast::VisibilityOwner for EnumDef {}
229impl ast::NameOwner for EnumDef {}
230impl ast::TypeParamsOwner for EnumDef {}
231impl ast::AttrsOwner for EnumDef {}
232impl ast::DocCommentsOwner for EnumDef {}
233impl EnumDef {
234 pub fn enum_kw_token(&self) -> Option<EnumKw> { support::token(&self.syntax) }
235 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
236}
237#[derive(Debug, Clone, PartialEq, Eq, Hash)]
238pub struct EnumVariantList {
239 pub(crate) syntax: SyntaxNode,
240}
241impl AstNode for EnumVariantList {
242 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST }
243 fn cast(syntax: SyntaxNode) -> Option<Self> {
244 if Self::can_cast(syntax.kind()) {
245 Some(Self { syntax })
246 } else {
247 None
248 }
249 }
250 fn syntax(&self) -> &SyntaxNode { &self.syntax }
251}
252impl EnumVariantList {
253 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
254 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) }
255 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
256}
257#[derive(Debug, Clone, PartialEq, Eq, Hash)]
258pub struct EnumVariant {
259 pub(crate) syntax: SyntaxNode,
260}
261impl AstNode for EnumVariant {
262 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT }
263 fn cast(syntax: SyntaxNode) -> Option<Self> {
264 if Self::can_cast(syntax.kind()) {
265 Some(Self { syntax })
266 } else {
267 None
268 }
269 }
270 fn syntax(&self) -> &SyntaxNode { &self.syntax }
271}
272impl ast::VisibilityOwner for EnumVariant {}
273impl ast::NameOwner for EnumVariant {}
274impl ast::DocCommentsOwner for EnumVariant {}
275impl ast::AttrsOwner for EnumVariant {}
276impl EnumVariant {
277 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
278 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
279 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
280}
281#[derive(Debug, Clone, PartialEq, Eq, Hash)]
282pub struct TraitDef {
283 pub(crate) syntax: SyntaxNode,
284}
285impl AstNode for TraitDef {
286 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF }
287 fn cast(syntax: SyntaxNode) -> Option<Self> {
288 if Self::can_cast(syntax.kind()) {
289 Some(Self { syntax })
290 } else {
291 None
292 }
293 }
294 fn syntax(&self) -> &SyntaxNode { &self.syntax }
295}
296impl ast::VisibilityOwner for TraitDef {}
297impl ast::NameOwner for TraitDef {}
298impl ast::AttrsOwner for TraitDef {}
299impl ast::DocCommentsOwner for TraitDef {}
300impl ast::TypeParamsOwner for TraitDef {}
301impl ast::TypeBoundsOwner for TraitDef {}
302impl TraitDef {
303 pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
304 pub fn auto_kw_token(&self) -> Option<AutoKw> { support::token(&self.syntax) }
305 pub fn trait_kw_token(&self) -> Option<TraitKw> { support::token(&self.syntax) }
306 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
307}
308#[derive(Debug, Clone, PartialEq, Eq, Hash)]
309pub struct Module {
310 pub(crate) syntax: SyntaxNode,
311}
312impl AstNode for Module {
313 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
314 fn cast(syntax: SyntaxNode) -> Option<Self> {
315 if Self::can_cast(syntax.kind()) {
316 Some(Self { syntax })
317 } else {
318 None
319 }
320 }
321 fn syntax(&self) -> &SyntaxNode { &self.syntax }
322}
323impl ast::VisibilityOwner for Module {}
324impl ast::NameOwner for Module {}
325impl ast::AttrsOwner for Module {}
326impl ast::DocCommentsOwner for Module {}
327impl Module {
328 pub fn mod_kw_token(&self) -> Option<ModKw> { support::token(&self.syntax) }
329 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
330 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
331}
332#[derive(Debug, Clone, PartialEq, Eq, Hash)]
333pub struct ItemList {
334 pub(crate) syntax: SyntaxNode,
335}
336impl AstNode for ItemList {
337 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
338 fn cast(syntax: SyntaxNode) -> Option<Self> {
339 if Self::can_cast(syntax.kind()) {
340 Some(Self { syntax })
341 } else {
342 None
343 }
344 }
345 fn syntax(&self) -> &SyntaxNode { &self.syntax }
346}
347impl ast::FnDefOwner for ItemList {}
348impl ast::ModuleItemOwner for ItemList {}
349impl ItemList {
350 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
351 pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) }
352 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
353}
354#[derive(Debug, Clone, PartialEq, Eq, Hash)]
355pub struct ConstDef {
356 pub(crate) syntax: SyntaxNode,
357}
358impl AstNode for ConstDef {
359 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF }
360 fn cast(syntax: SyntaxNode) -> Option<Self> {
361 if Self::can_cast(syntax.kind()) {
362 Some(Self { syntax })
363 } else {
364 None
365 }
366 }
367 fn syntax(&self) -> &SyntaxNode { &self.syntax }
368}
369impl ast::VisibilityOwner for ConstDef {}
370impl ast::NameOwner for ConstDef {}
371impl ast::TypeParamsOwner for ConstDef {}
372impl ast::AttrsOwner for ConstDef {}
373impl ast::DocCommentsOwner for ConstDef {}
374impl ast::TypeAscriptionOwner for ConstDef {}
375impl ConstDef {
376 pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
377 pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
378 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
379 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
380 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
381}
382#[derive(Debug, Clone, PartialEq, Eq, Hash)]
383pub struct StaticDef {
384 pub(crate) syntax: SyntaxNode,
385}
386impl AstNode for StaticDef {
387 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF }
388 fn cast(syntax: SyntaxNode) -> Option<Self> {
389 if Self::can_cast(syntax.kind()) {
390 Some(Self { syntax })
391 } else {
392 None
393 }
394 }
395 fn syntax(&self) -> &SyntaxNode { &self.syntax }
396}
397impl ast::VisibilityOwner for StaticDef {}
398impl ast::NameOwner for StaticDef {}
399impl ast::TypeParamsOwner for StaticDef {}
400impl ast::AttrsOwner for StaticDef {}
401impl ast::DocCommentsOwner for StaticDef {}
402impl ast::TypeAscriptionOwner for StaticDef {}
403impl StaticDef {
404 pub fn static_kw_token(&self) -> Option<StaticKw> { support::token(&self.syntax) }
405 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
406 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
407 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
408 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
409}
410#[derive(Debug, Clone, PartialEq, Eq, Hash)]
411pub struct TypeAliasDef {
412 pub(crate) syntax: SyntaxNode,
413}
414impl AstNode for TypeAliasDef {
415 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF }
416 fn cast(syntax: SyntaxNode) -> Option<Self> {
417 if Self::can_cast(syntax.kind()) {
418 Some(Self { syntax })
419 } else {
420 None
421 }
422 }
423 fn syntax(&self) -> &SyntaxNode { &self.syntax }
424}
425impl ast::VisibilityOwner for TypeAliasDef {}
426impl ast::NameOwner for TypeAliasDef {}
427impl ast::TypeParamsOwner for TypeAliasDef {}
428impl ast::AttrsOwner for TypeAliasDef {}
429impl ast::DocCommentsOwner for TypeAliasDef {}
430impl ast::TypeBoundsOwner for TypeAliasDef {}
431impl TypeAliasDef {
432 pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
433 pub fn type_kw_token(&self) -> Option<TypeKw> { support::token(&self.syntax) }
434 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
435 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
436 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
437}
438#[derive(Debug, Clone, PartialEq, Eq, Hash)]
439pub struct ImplDef {
440 pub(crate) syntax: SyntaxNode,
441}
442impl AstNode for ImplDef {
443 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF }
444 fn cast(syntax: SyntaxNode) -> Option<Self> {
445 if Self::can_cast(syntax.kind()) {
446 Some(Self { syntax })
447 } else {
448 None
449 }
450 }
451 fn syntax(&self) -> &SyntaxNode { &self.syntax }
452}
453impl ast::TypeParamsOwner for ImplDef {}
454impl ast::AttrsOwner for ImplDef {}
455impl ImplDef {
456 pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
457 pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
458 pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
459 pub fn impl_kw_token(&self) -> Option<ImplKw> { support::token(&self.syntax) }
460 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
461 pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
462 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
463}
464#[derive(Debug, Clone, PartialEq, Eq, Hash)]
465pub struct ParenType {
466 pub(crate) syntax: SyntaxNode,
467}
468impl AstNode for ParenType {
469 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
470 fn cast(syntax: SyntaxNode) -> Option<Self> {
471 if Self::can_cast(syntax.kind()) {
472 Some(Self { syntax })
473 } else {
474 None
475 }
476 }
477 fn syntax(&self) -> &SyntaxNode { &self.syntax }
478}
479impl ParenType {
480 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
481 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
482 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
483}
484#[derive(Debug, Clone, PartialEq, Eq, Hash)]
485pub struct TupleType {
486 pub(crate) syntax: SyntaxNode,
487}
488impl AstNode for TupleType {
489 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
490 fn cast(syntax: SyntaxNode) -> Option<Self> {
491 if Self::can_cast(syntax.kind()) {
492 Some(Self { syntax })
493 } else {
494 None
495 }
496 }
497 fn syntax(&self) -> &SyntaxNode { &self.syntax }
498}
499impl TupleType {
500 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
501 pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) }
502 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
503}
504#[derive(Debug, Clone, PartialEq, Eq, Hash)]
505pub struct NeverType {
506 pub(crate) syntax: SyntaxNode,
507}
508impl AstNode for NeverType {
509 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
510 fn cast(syntax: SyntaxNode) -> Option<Self> {
511 if Self::can_cast(syntax.kind()) {
512 Some(Self { syntax })
513 } else {
514 None
515 }
516 }
517 fn syntax(&self) -> &SyntaxNode { &self.syntax }
518}
519impl NeverType {
520 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
521}
522#[derive(Debug, Clone, PartialEq, Eq, Hash)]
523pub struct PathType {
524 pub(crate) syntax: SyntaxNode,
525}
526impl AstNode for PathType {
527 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
528 fn cast(syntax: SyntaxNode) -> Option<Self> {
529 if Self::can_cast(syntax.kind()) {
530 Some(Self { syntax })
531 } else {
532 None
533 }
534 }
535 fn syntax(&self) -> &SyntaxNode { &self.syntax }
536}
537impl PathType {
538 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
539}
540#[derive(Debug, Clone, PartialEq, Eq, Hash)]
541pub struct PointerType {
542 pub(crate) syntax: SyntaxNode,
543}
544impl AstNode for PointerType {
545 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE }
546 fn cast(syntax: SyntaxNode) -> Option<Self> {
547 if Self::can_cast(syntax.kind()) {
548 Some(Self { syntax })
549 } else {
550 None
551 }
552 }
553 fn syntax(&self) -> &SyntaxNode { &self.syntax }
554}
555impl PointerType {
556 pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) }
557 pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
558 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
559 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
560}
561#[derive(Debug, Clone, PartialEq, Eq, Hash)]
562pub struct ArrayType {
563 pub(crate) syntax: SyntaxNode,
564}
565impl AstNode for ArrayType {
566 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
567 fn cast(syntax: SyntaxNode) -> Option<Self> {
568 if Self::can_cast(syntax.kind()) {
569 Some(Self { syntax })
570 } else {
571 None
572 }
573 }
574 fn syntax(&self) -> &SyntaxNode { &self.syntax }
575}
576impl ArrayType {
577 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
578 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
579 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
580 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
581 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
582}
583#[derive(Debug, Clone, PartialEq, Eq, Hash)]
584pub struct SliceType {
585 pub(crate) syntax: SyntaxNode,
586}
587impl AstNode for SliceType {
588 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
589 fn cast(syntax: SyntaxNode) -> Option<Self> {
590 if Self::can_cast(syntax.kind()) {
591 Some(Self { syntax })
592 } else {
593 None
594 }
595 }
596 fn syntax(&self) -> &SyntaxNode { &self.syntax }
597}
598impl SliceType {
599 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
600 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
601 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
602}
603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
604pub struct ReferenceType {
605 pub(crate) syntax: SyntaxNode,
606}
607impl AstNode for ReferenceType {
608 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE }
609 fn cast(syntax: SyntaxNode) -> Option<Self> {
610 if Self::can_cast(syntax.kind()) {
611 Some(Self { syntax })
612 } else {
613 None
614 }
615 }
616 fn syntax(&self) -> &SyntaxNode { &self.syntax }
617}
618impl ReferenceType {
619 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
620 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
621 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
622 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
623}
624#[derive(Debug, Clone, PartialEq, Eq, Hash)]
625pub struct PlaceholderType {
626 pub(crate) syntax: SyntaxNode,
627}
628impl AstNode for PlaceholderType {
629 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE }
630 fn cast(syntax: SyntaxNode) -> Option<Self> {
631 if Self::can_cast(syntax.kind()) {
632 Some(Self { syntax })
633 } else {
634 None
635 }
636 }
637 fn syntax(&self) -> &SyntaxNode { &self.syntax }
638}
639impl PlaceholderType {
640 pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) }
641}
642#[derive(Debug, Clone, PartialEq, Eq, Hash)]
643pub struct FnPointerType {
644 pub(crate) syntax: SyntaxNode,
645}
646impl AstNode for FnPointerType {
647 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE }
648 fn cast(syntax: SyntaxNode) -> Option<Self> {
649 if Self::can_cast(syntax.kind()) {
650 Some(Self { syntax })
651 } else {
652 None
653 }
654 }
655 fn syntax(&self) -> &SyntaxNode { &self.syntax }
656}
657impl FnPointerType {
658 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
659 pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
660 pub fn fn_kw_token(&self) -> Option<FnKw> { support::token(&self.syntax) }
661 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
662 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
663}
664#[derive(Debug, Clone, PartialEq, Eq, Hash)]
665pub struct ForType {
666 pub(crate) syntax: SyntaxNode,
667}
668impl AstNode for ForType {
669 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
670 fn cast(syntax: SyntaxNode) -> Option<Self> {
671 if Self::can_cast(syntax.kind()) {
672 Some(Self { syntax })
673 } else {
674 None
675 }
676 }
677 fn syntax(&self) -> &SyntaxNode { &self.syntax }
678}
679impl ForType {
680 pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
681 pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) }
682 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
683}
684#[derive(Debug, Clone, PartialEq, Eq, Hash)]
685pub struct ImplTraitType {
686 pub(crate) syntax: SyntaxNode,
687}
688impl AstNode for ImplTraitType {
689 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
690 fn cast(syntax: SyntaxNode) -> Option<Self> {
691 if Self::can_cast(syntax.kind()) {
692 Some(Self { syntax })
693 } else {
694 None
695 }
696 }
697 fn syntax(&self) -> &SyntaxNode { &self.syntax }
698}
699impl ast::TypeBoundsOwner for ImplTraitType {}
700impl ImplTraitType {
701 pub fn impl_kw_token(&self) -> Option<ImplKw> { support::token(&self.syntax) }
702}
703#[derive(Debug, Clone, PartialEq, Eq, Hash)]
704pub struct DynTraitType {
705 pub(crate) syntax: SyntaxNode,
706}
707impl AstNode for DynTraitType {
708 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
709 fn cast(syntax: SyntaxNode) -> Option<Self> {
710 if Self::can_cast(syntax.kind()) {
711 Some(Self { syntax })
712 } else {
713 None
714 }
715 }
716 fn syntax(&self) -> &SyntaxNode { &self.syntax }
717}
718impl ast::TypeBoundsOwner for DynTraitType {}
719impl DynTraitType {
720 pub fn dyn_kw_token(&self) -> Option<DynKw> { support::token(&self.syntax) }
721}
722#[derive(Debug, Clone, PartialEq, Eq, Hash)]
723pub struct TupleExpr {
724 pub(crate) syntax: SyntaxNode,
725}
726impl AstNode for TupleExpr {
727 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
728 fn cast(syntax: SyntaxNode) -> Option<Self> {
729 if Self::can_cast(syntax.kind()) {
730 Some(Self { syntax })
731 } else {
732 None
733 }
734 }
735 fn syntax(&self) -> &SyntaxNode { &self.syntax }
736}
737impl ast::AttrsOwner for TupleExpr {}
738impl TupleExpr {
739 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
740 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
741 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
742}
743#[derive(Debug, Clone, PartialEq, Eq, Hash)]
744pub struct ArrayExpr {
745 pub(crate) syntax: SyntaxNode,
746}
747impl AstNode for ArrayExpr {
748 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
749 fn cast(syntax: SyntaxNode) -> Option<Self> {
750 if Self::can_cast(syntax.kind()) {
751 Some(Self { syntax })
752 } else {
753 None
754 }
755 }
756 fn syntax(&self) -> &SyntaxNode { &self.syntax }
757}
758impl ast::AttrsOwner for ArrayExpr {}
759impl ArrayExpr {
760 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
761 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
762 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
763 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
764}
765#[derive(Debug, Clone, PartialEq, Eq, Hash)]
766pub struct ParenExpr {
767 pub(crate) syntax: SyntaxNode,
768}
769impl AstNode for ParenExpr {
770 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
771 fn cast(syntax: SyntaxNode) -> Option<Self> {
772 if Self::can_cast(syntax.kind()) {
773 Some(Self { syntax })
774 } else {
775 None
776 }
777 }
778 fn syntax(&self) -> &SyntaxNode { &self.syntax }
779}
780impl ast::AttrsOwner for ParenExpr {}
781impl ParenExpr {
782 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
783 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
784 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
785}
786#[derive(Debug, Clone, PartialEq, Eq, Hash)]
787pub struct PathExpr {
788 pub(crate) syntax: SyntaxNode,
789}
790impl AstNode for PathExpr {
791 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
792 fn cast(syntax: SyntaxNode) -> Option<Self> {
793 if Self::can_cast(syntax.kind()) {
794 Some(Self { syntax })
795 } else {
796 None
797 }
798 }
799 fn syntax(&self) -> &SyntaxNode { &self.syntax }
800}
801impl PathExpr {
802 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
803}
804#[derive(Debug, Clone, PartialEq, Eq, Hash)]
805pub struct LambdaExpr {
806 pub(crate) syntax: SyntaxNode,
807}
808impl AstNode for LambdaExpr {
809 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR }
810 fn cast(syntax: SyntaxNode) -> Option<Self> {
811 if Self::can_cast(syntax.kind()) {
812 Some(Self { syntax })
813 } else {
814 None
815 }
816 }
817 fn syntax(&self) -> &SyntaxNode { &self.syntax }
818}
819impl ast::AttrsOwner for LambdaExpr {}
820impl LambdaExpr {
821 pub fn static_kw_token(&self) -> Option<StaticKw> { support::token(&self.syntax) }
822 pub fn async_kw_token(&self) -> Option<AsyncKw> { support::token(&self.syntax) }
823 pub fn move_kw_token(&self) -> Option<MoveKw> { support::token(&self.syntax) }
824 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
825 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
826 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
827}
828#[derive(Debug, Clone, PartialEq, Eq, Hash)]
829pub struct IfExpr {
830 pub(crate) syntax: SyntaxNode,
831}
832impl AstNode for IfExpr {
833 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
834 fn cast(syntax: SyntaxNode) -> Option<Self> {
835 if Self::can_cast(syntax.kind()) {
836 Some(Self { syntax })
837 } else {
838 None
839 }
840 }
841 fn syntax(&self) -> &SyntaxNode { &self.syntax }
842}
843impl ast::AttrsOwner for IfExpr {}
844impl IfExpr {
845 pub fn if_kw_token(&self) -> Option<IfKw> { support::token(&self.syntax) }
846 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
847}
848#[derive(Debug, Clone, PartialEq, Eq, Hash)]
849pub struct LoopExpr {
850 pub(crate) syntax: SyntaxNode,
851}
852impl AstNode for LoopExpr {
853 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
854 fn cast(syntax: SyntaxNode) -> Option<Self> {
855 if Self::can_cast(syntax.kind()) {
856 Some(Self { syntax })
857 } else {
858 None
859 }
860 }
861 fn syntax(&self) -> &SyntaxNode { &self.syntax }
862}
863impl ast::AttrsOwner for LoopExpr {}
864impl ast::LoopBodyOwner for LoopExpr {}
865impl LoopExpr {
866 pub fn loop_kw_token(&self) -> Option<LoopKw> { support::token(&self.syntax) }
867}
868#[derive(Debug, Clone, PartialEq, Eq, Hash)]
869pub struct TryBlockExpr {
870 pub(crate) syntax: SyntaxNode,
871}
872impl AstNode for TryBlockExpr {
873 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR }
874 fn cast(syntax: SyntaxNode) -> Option<Self> {
875 if Self::can_cast(syntax.kind()) {
876 Some(Self { syntax })
877 } else {
878 None
879 }
880 }
881 fn syntax(&self) -> &SyntaxNode { &self.syntax }
882}
883impl ast::AttrsOwner for TryBlockExpr {}
884impl TryBlockExpr {
885 pub fn try_kw_token(&self) -> Option<TryKw> { support::token(&self.syntax) }
886 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
887}
888#[derive(Debug, Clone, PartialEq, Eq, Hash)]
889pub struct ForExpr {
890 pub(crate) syntax: SyntaxNode,
891}
892impl AstNode for ForExpr {
893 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
894 fn cast(syntax: SyntaxNode) -> Option<Self> {
895 if Self::can_cast(syntax.kind()) {
896 Some(Self { syntax })
897 } else {
898 None
899 }
900 }
901 fn syntax(&self) -> &SyntaxNode { &self.syntax }
902}
903impl ast::AttrsOwner for ForExpr {}
904impl ast::LoopBodyOwner for ForExpr {}
905impl ForExpr {
906 pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
907 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
908 pub fn in_kw_token(&self) -> Option<InKw> { support::token(&self.syntax) }
909 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
910}
911#[derive(Debug, Clone, PartialEq, Eq, Hash)]
912pub struct WhileExpr {
913 pub(crate) syntax: SyntaxNode,
914}
915impl AstNode for WhileExpr {
916 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
917 fn cast(syntax: SyntaxNode) -> Option<Self> {
918 if Self::can_cast(syntax.kind()) {
919 Some(Self { syntax })
920 } else {
921 None
922 }
923 }
924 fn syntax(&self) -> &SyntaxNode { &self.syntax }
925}
926impl ast::AttrsOwner for WhileExpr {}
927impl ast::LoopBodyOwner for WhileExpr {}
928impl WhileExpr {
929 pub fn while_kw_token(&self) -> Option<WhileKw> { support::token(&self.syntax) }
930 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
931}
932#[derive(Debug, Clone, PartialEq, Eq, Hash)]
933pub struct ContinueExpr {
934 pub(crate) syntax: SyntaxNode,
935}
936impl AstNode for ContinueExpr {
937 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
938 fn cast(syntax: SyntaxNode) -> Option<Self> {
939 if Self::can_cast(syntax.kind()) {
940 Some(Self { syntax })
941 } else {
942 None
943 }
944 }
945 fn syntax(&self) -> &SyntaxNode { &self.syntax }
946}
947impl ast::AttrsOwner for ContinueExpr {}
948impl ContinueExpr {
949 pub fn continue_kw_token(&self) -> Option<ContinueKw> { support::token(&self.syntax) }
950 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
951}
952#[derive(Debug, Clone, PartialEq, Eq, Hash)]
953pub struct BreakExpr {
954 pub(crate) syntax: SyntaxNode,
955}
956impl AstNode for BreakExpr {
957 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
958 fn cast(syntax: SyntaxNode) -> Option<Self> {
959 if Self::can_cast(syntax.kind()) {
960 Some(Self { syntax })
961 } else {
962 None
963 }
964 }
965 fn syntax(&self) -> &SyntaxNode { &self.syntax }
966}
967impl ast::AttrsOwner for BreakExpr {}
968impl BreakExpr {
969 pub fn break_kw_token(&self) -> Option<BreakKw> { support::token(&self.syntax) }
970 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
971 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
972}
973#[derive(Debug, Clone, PartialEq, Eq, Hash)]
974pub struct Label {
975 pub(crate) syntax: SyntaxNode,
976}
977impl AstNode for Label {
978 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
979 fn cast(syntax: SyntaxNode) -> Option<Self> {
980 if Self::can_cast(syntax.kind()) {
981 Some(Self { syntax })
982 } else {
983 None
984 }
985 }
986 fn syntax(&self) -> &SyntaxNode { &self.syntax }
987}
988impl Label {
989 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
990}
991#[derive(Debug, Clone, PartialEq, Eq, Hash)]
992pub struct BlockExpr {
993 pub(crate) syntax: SyntaxNode,
994}
995impl AstNode for BlockExpr {
996 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
997 fn cast(syntax: SyntaxNode) -> Option<Self> {
998 if Self::can_cast(syntax.kind()) {
999 Some(Self { syntax })
1000 } else {
1001 None
1002 }
1003 }
1004 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1005}
1006impl ast::AttrsOwner for BlockExpr {}
1007impl BlockExpr {
1008 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
1009 pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
1010 pub fn block(&self) -> Option<Block> { support::child(&self.syntax) }
1011}
1012#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1013pub struct ReturnExpr {
1014 pub(crate) syntax: SyntaxNode,
1015}
1016impl AstNode for ReturnExpr {
1017 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
1018 fn cast(syntax: SyntaxNode) -> Option<Self> {
1019 if Self::can_cast(syntax.kind()) {
1020 Some(Self { syntax })
1021 } else {
1022 None
1023 }
1024 }
1025 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1026}
1027impl ast::AttrsOwner for ReturnExpr {}
1028impl ReturnExpr {
1029 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1030}
1031#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1032pub struct CallExpr {
1033 pub(crate) syntax: SyntaxNode,
1034}
1035impl AstNode for CallExpr {
1036 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
1037 fn cast(syntax: SyntaxNode) -> Option<Self> {
1038 if Self::can_cast(syntax.kind()) {
1039 Some(Self { syntax })
1040 } else {
1041 None
1042 }
1043 }
1044 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1045}
1046impl ast::ArgListOwner for CallExpr {}
1047impl CallExpr {
1048 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1049}
1050#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1051pub struct MethodCallExpr {
1052 pub(crate) syntax: SyntaxNode,
1053}
1054impl AstNode for MethodCallExpr {
1055 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
1056 fn cast(syntax: SyntaxNode) -> Option<Self> {
1057 if Self::can_cast(syntax.kind()) {
1058 Some(Self { syntax })
1059 } else {
1060 None
1061 }
1062 }
1063 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1064}
1065impl ast::AttrsOwner for MethodCallExpr {}
1066impl ast::ArgListOwner for MethodCallExpr {}
1067impl MethodCallExpr {
1068 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1069 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) }
1070 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1071 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1072}
1073#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1074pub struct IndexExpr {
1075 pub(crate) syntax: SyntaxNode,
1076}
1077impl AstNode for IndexExpr {
1078 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
1079 fn cast(syntax: SyntaxNode) -> Option<Self> {
1080 if Self::can_cast(syntax.kind()) {
1081 Some(Self { syntax })
1082 } else {
1083 None
1084 }
1085 }
1086 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1087}
1088impl ast::AttrsOwner for IndexExpr {}
1089impl IndexExpr {
1090 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
1091 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
1092}
1093#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1094pub struct FieldExpr {
1095 pub(crate) syntax: SyntaxNode,
1096}
1097impl AstNode for FieldExpr {
1098 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
1099 fn cast(syntax: SyntaxNode) -> Option<Self> {
1100 if Self::can_cast(syntax.kind()) {
1101 Some(Self { syntax })
1102 } else {
1103 None
1104 }
1105 }
1106 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1107}
1108impl ast::AttrsOwner for FieldExpr {}
1109impl FieldExpr {
1110 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1111 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) }
1112 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1113}
1114#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1115pub struct AwaitExpr {
1116 pub(crate) syntax: SyntaxNode,
1117}
1118impl AstNode for AwaitExpr {
1119 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
1120 fn cast(syntax: SyntaxNode) -> Option<Self> {
1121 if Self::can_cast(syntax.kind()) {
1122 Some(Self { syntax })
1123 } else {
1124 None
1125 }
1126 }
1127 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1128}
1129impl ast::AttrsOwner for AwaitExpr {}
1130impl AwaitExpr {
1131 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1132 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) }
1133 pub fn await_kw_token(&self) -> Option<AwaitKw> { support::token(&self.syntax) }
1134}
1135#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1136pub struct TryExpr {
1137 pub(crate) syntax: SyntaxNode,
1138}
1139impl AstNode for TryExpr {
1140 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
1141 fn cast(syntax: SyntaxNode) -> Option<Self> {
1142 if Self::can_cast(syntax.kind()) {
1143 Some(Self { syntax })
1144 } else {
1145 None
1146 }
1147 }
1148 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1149}
1150impl ast::AttrsOwner for TryExpr {}
1151impl TryExpr {
1152 pub fn try_kw_token(&self) -> Option<TryKw> { support::token(&self.syntax) }
1153 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1154}
1155#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1156pub struct CastExpr {
1157 pub(crate) syntax: SyntaxNode,
1158}
1159impl AstNode for CastExpr {
1160 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
1161 fn cast(syntax: SyntaxNode) -> Option<Self> {
1162 if Self::can_cast(syntax.kind()) {
1163 Some(Self { syntax })
1164 } else {
1165 None
1166 }
1167 }
1168 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1169}
1170impl ast::AttrsOwner for CastExpr {}
1171impl CastExpr {
1172 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1173 pub fn as_kw_token(&self) -> Option<AsKw> { support::token(&self.syntax) }
1174 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1175}
1176#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1177pub struct RefExpr {
1178 pub(crate) syntax: SyntaxNode,
1179}
1180impl AstNode for RefExpr {
1181 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
1182 fn cast(syntax: SyntaxNode) -> Option<Self> {
1183 if Self::can_cast(syntax.kind()) {
1184 Some(Self { syntax })
1185 } else {
1186 None
1187 }
1188 }
1189 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1190}
1191impl ast::AttrsOwner for RefExpr {}
1192impl RefExpr {
1193 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
1194 pub fn raw_kw_token(&self) -> Option<RawKw> { support::token(&self.syntax) }
1195 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
1196 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1197}
1198#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1199pub struct PrefixExpr {
1200 pub(crate) syntax: SyntaxNode,
1201}
1202impl AstNode for PrefixExpr {
1203 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
1204 fn cast(syntax: SyntaxNode) -> Option<Self> {
1205 if Self::can_cast(syntax.kind()) {
1206 Some(Self { syntax })
1207 } else {
1208 None
1209 }
1210 }
1211 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1212}
1213impl ast::AttrsOwner for PrefixExpr {}
1214impl PrefixExpr {
1215 pub fn prefix_op_token(&self) -> Option<PrefixOp> { support::token(&self.syntax) }
1216 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1217}
1218#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1219pub struct BoxExpr {
1220 pub(crate) syntax: SyntaxNode,
1221}
1222impl AstNode for BoxExpr {
1223 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
1224 fn cast(syntax: SyntaxNode) -> Option<Self> {
1225 if Self::can_cast(syntax.kind()) {
1226 Some(Self { syntax })
1227 } else {
1228 None
1229 }
1230 }
1231 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1232}
1233impl ast::AttrsOwner for BoxExpr {}
1234impl BoxExpr {
1235 pub fn box_kw_token(&self) -> Option<BoxKw> { support::token(&self.syntax) }
1236 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1237}
1238#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1239pub struct RangeExpr {
1240 pub(crate) syntax: SyntaxNode,
1241}
1242impl AstNode for RangeExpr {
1243 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
1244 fn cast(syntax: SyntaxNode) -> Option<Self> {
1245 if Self::can_cast(syntax.kind()) {
1246 Some(Self { syntax })
1247 } else {
1248 None
1249 }
1250 }
1251 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1252}
1253impl ast::AttrsOwner for RangeExpr {}
1254impl RangeExpr {
1255 pub fn range_op_token(&self) -> Option<RangeOp> { support::token(&self.syntax) }
1256}
1257#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1258pub struct BinExpr {
1259 pub(crate) syntax: SyntaxNode,
1260}
1261impl AstNode for BinExpr {
1262 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
1263 fn cast(syntax: SyntaxNode) -> Option<Self> {
1264 if Self::can_cast(syntax.kind()) {
1265 Some(Self { syntax })
1266 } else {
1267 None
1268 }
1269 }
1270 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1271}
1272impl ast::AttrsOwner for BinExpr {}
1273impl BinExpr {
1274 pub fn bin_op_token(&self) -> Option<BinOp> { support::token(&self.syntax) }
1275}
1276#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1277pub struct Literal {
1278 pub(crate) syntax: SyntaxNode,
1279}
1280impl AstNode for Literal {
1281 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
1282 fn cast(syntax: SyntaxNode) -> Option<Self> {
1283 if Self::can_cast(syntax.kind()) {
1284 Some(Self { syntax })
1285 } else {
1286 None
1287 }
1288 }
1289 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1290}
1291impl Literal {
1292 pub fn literal_token_token(&self) -> Option<LiteralToken> { support::token(&self.syntax) }
1293}
1294#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1295pub struct MatchExpr {
1296 pub(crate) syntax: SyntaxNode,
1297}
1298impl AstNode for MatchExpr {
1299 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
1300 fn cast(syntax: SyntaxNode) -> Option<Self> {
1301 if Self::can_cast(syntax.kind()) {
1302 Some(Self { syntax })
1303 } else {
1304 None
1305 }
1306 }
1307 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1308}
1309impl ast::AttrsOwner for MatchExpr {}
1310impl MatchExpr {
1311 pub fn match_kw_token(&self) -> Option<MatchKw> { support::token(&self.syntax) }
1312 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1313 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
1314}
1315#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1316pub struct MatchArmList {
1317 pub(crate) syntax: SyntaxNode,
1318}
1319impl AstNode for MatchArmList {
1320 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
1321 fn cast(syntax: SyntaxNode) -> Option<Self> {
1322 if Self::can_cast(syntax.kind()) {
1323 Some(Self { syntax })
1324 } else {
1325 None
1326 }
1327 }
1328 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1329}
1330impl ast::AttrsOwner for MatchArmList {}
1331impl MatchArmList {
1332 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
1333 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
1334 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
1335}
1336#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1337pub struct MatchArm {
1338 pub(crate) syntax: SyntaxNode,
1339}
1340impl AstNode for MatchArm {
1341 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
1342 fn cast(syntax: SyntaxNode) -> Option<Self> {
1343 if Self::can_cast(syntax.kind()) {
1344 Some(Self { syntax })
1345 } else {
1346 None
1347 }
1348 }
1349 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1350}
1351impl ast::AttrsOwner for MatchArm {}
1352impl MatchArm {
1353 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1354 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
1355 pub fn fat_arrow_token(&self) -> Option<FatArrow> { support::token(&self.syntax) }
1356 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1357}
1358#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1359pub struct MatchGuard {
1360 pub(crate) syntax: SyntaxNode,
1361}
1362impl AstNode for MatchGuard {
1363 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
1364 fn cast(syntax: SyntaxNode) -> Option<Self> {
1365 if Self::can_cast(syntax.kind()) {
1366 Some(Self { syntax })
1367 } else {
1368 None
1369 }
1370 }
1371 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1372}
1373impl MatchGuard {
1374 pub fn if_kw_token(&self) -> Option<IfKw> { support::token(&self.syntax) }
1375 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1376}
1377#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1378pub struct RecordLit {
1379 pub(crate) syntax: SyntaxNode,
1380}
1381impl AstNode for RecordLit {
1382 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT }
1383 fn cast(syntax: SyntaxNode) -> Option<Self> {
1384 if Self::can_cast(syntax.kind()) {
1385 Some(Self { syntax })
1386 } else {
1387 None
1388 }
1389 }
1390 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1391}
1392impl RecordLit {
1393 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1394 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
1395}
1396#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1397pub struct RecordFieldList {
1398 pub(crate) syntax: SyntaxNode,
1399}
1400impl AstNode for RecordFieldList {
1401 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
1402 fn cast(syntax: SyntaxNode) -> Option<Self> {
1403 if Self::can_cast(syntax.kind()) {
1404 Some(Self { syntax })
1405 } else {
1406 None
1407 }
1408 }
1409 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1410}
1411impl RecordFieldList {
1412 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
1413 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
1414 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) }
1415 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1416 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
1417}
1418#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1419pub struct RecordField {
1420 pub(crate) syntax: SyntaxNode,
1421}
1422impl AstNode for RecordField {
1423 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
1424 fn cast(syntax: SyntaxNode) -> Option<Self> {
1425 if Self::can_cast(syntax.kind()) {
1426 Some(Self { syntax })
1427 } else {
1428 None
1429 }
1430 }
1431 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1432}
1433impl ast::AttrsOwner for RecordField {}
1434impl RecordField {
1435 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1436 pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) }
1437 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1438}
1439#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1440pub struct OrPat {
1441 pub(crate) syntax: SyntaxNode,
1442}
1443impl AstNode for OrPat {
1444 fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT }
1445 fn cast(syntax: SyntaxNode) -> Option<Self> {
1446 if Self::can_cast(syntax.kind()) {
1447 Some(Self { syntax })
1448 } else {
1449 None
1450 }
1451 }
1452 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1453}
1454impl OrPat {
1455 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1456}
1457#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1458pub struct ParenPat {
1459 pub(crate) syntax: SyntaxNode,
1460}
1461impl AstNode for ParenPat {
1462 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT }
1463 fn cast(syntax: SyntaxNode) -> Option<Self> {
1464 if Self::can_cast(syntax.kind()) {
1465 Some(Self { syntax })
1466 } else {
1467 None
1468 }
1469 }
1470 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1471}
1472impl ParenPat {
1473 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
1474 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1475 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
1476}
1477#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1478pub struct RefPat {
1479 pub(crate) syntax: SyntaxNode,
1480}
1481impl AstNode for RefPat {
1482 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT }
1483 fn cast(syntax: SyntaxNode) -> Option<Self> {
1484 if Self::can_cast(syntax.kind()) {
1485 Some(Self { syntax })
1486 } else {
1487 None
1488 }
1489 }
1490 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1491}
1492impl RefPat {
1493 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
1494 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
1495 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1496}
1497#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1498pub struct BoxPat {
1499 pub(crate) syntax: SyntaxNode,
1500}
1501impl AstNode for BoxPat {
1502 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT }
1503 fn cast(syntax: SyntaxNode) -> Option<Self> {
1504 if Self::can_cast(syntax.kind()) {
1505 Some(Self { syntax })
1506 } else {
1507 None
1508 }
1509 }
1510 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1511}
1512impl BoxPat {
1513 pub fn box_kw_token(&self) -> Option<BoxKw> { support::token(&self.syntax) }
1514 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1515}
1516#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1517pub struct BindPat {
1518 pub(crate) syntax: SyntaxNode,
1519}
1520impl AstNode for BindPat {
1521 fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT }
1522 fn cast(syntax: SyntaxNode) -> Option<Self> {
1523 if Self::can_cast(syntax.kind()) {
1524 Some(Self { syntax })
1525 } else {
1526 None
1527 }
1528 }
1529 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1530}
1531impl ast::AttrsOwner for BindPat {}
1532impl ast::NameOwner for BindPat {}
1533impl BindPat {
1534 pub fn ref_kw_token(&self) -> Option<RefKw> { support::token(&self.syntax) }
1535 pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
1536 pub fn at_token(&self) -> Option<At> { support::token(&self.syntax) }
1537 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1538}
1539#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1540pub struct PlaceholderPat {
1541 pub(crate) syntax: SyntaxNode,
1542}
1543impl AstNode for PlaceholderPat {
1544 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT }
1545 fn cast(syntax: SyntaxNode) -> Option<Self> {
1546 if Self::can_cast(syntax.kind()) {
1547 Some(Self { syntax })
1548 } else {
1549 None
1550 }
1551 }
1552 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1553}
1554impl PlaceholderPat {
1555 pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) }
1556}
1557#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1558pub struct DotDotPat {
1559 pub(crate) syntax: SyntaxNode,
1560}
1561impl AstNode for DotDotPat {
1562 fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT }
1563 fn cast(syntax: SyntaxNode) -> Option<Self> {
1564 if Self::can_cast(syntax.kind()) {
1565 Some(Self { syntax })
1566 } else {
1567 None
1568 }
1569 }
1570 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1571}
1572impl DotDotPat {
1573 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) }
1574}
1575#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1576pub struct PathPat {
1577 pub(crate) syntax: SyntaxNode,
1578}
1579impl AstNode for PathPat {
1580 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT }
1581 fn cast(syntax: SyntaxNode) -> Option<Self> {
1582 if Self::can_cast(syntax.kind()) {
1583 Some(Self { syntax })
1584 } else {
1585 None
1586 }
1587 }
1588 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1589}
1590impl PathPat {
1591 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1592}
1593#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1594pub struct SlicePat {
1595 pub(crate) syntax: SyntaxNode,
1596}
1597impl AstNode for SlicePat {
1598 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT }
1599 fn cast(syntax: SyntaxNode) -> Option<Self> {
1600 if Self::can_cast(syntax.kind()) {
1601 Some(Self { syntax })
1602 } else {
1603 None
1604 }
1605 }
1606 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1607}
1608impl SlicePat {
1609 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
1610 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1611 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
1612}
1613#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1614pub struct RangePat {
1615 pub(crate) syntax: SyntaxNode,
1616}
1617impl AstNode for RangePat {
1618 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT }
1619 fn cast(syntax: SyntaxNode) -> Option<Self> {
1620 if Self::can_cast(syntax.kind()) {
1621 Some(Self { syntax })
1622 } else {
1623 None
1624 }
1625 }
1626 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1627}
1628impl RangePat {
1629 pub fn range_separator_token(&self) -> Option<RangeSeparator> { support::token(&self.syntax) }
1630}
1631#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1632pub struct LiteralPat {
1633 pub(crate) syntax: SyntaxNode,
1634}
1635impl AstNode for LiteralPat {
1636 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT }
1637 fn cast(syntax: SyntaxNode) -> Option<Self> {
1638 if Self::can_cast(syntax.kind()) {
1639 Some(Self { syntax })
1640 } else {
1641 None
1642 }
1643 }
1644 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1645}
1646impl LiteralPat {
1647 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1648}
1649#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1650pub struct MacroPat {
1651 pub(crate) syntax: SyntaxNode,
1652}
1653impl AstNode for MacroPat {
1654 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT }
1655 fn cast(syntax: SyntaxNode) -> Option<Self> {
1656 if Self::can_cast(syntax.kind()) {
1657 Some(Self { syntax })
1658 } else {
1659 None
1660 }
1661 }
1662 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1663}
1664impl MacroPat {
1665 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
1666}
1667#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1668pub struct RecordPat {
1669 pub(crate) syntax: SyntaxNode,
1670}
1671impl AstNode for RecordPat {
1672 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT }
1673 fn cast(syntax: SyntaxNode) -> Option<Self> {
1674 if Self::can_cast(syntax.kind()) {
1675 Some(Self { syntax })
1676 } else {
1677 None
1678 }
1679 }
1680 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1681}
1682impl RecordPat {
1683 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
1684 support::child(&self.syntax)
1685 }
1686 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1687}
1688#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1689pub struct RecordFieldPatList {
1690 pub(crate) syntax: SyntaxNode,
1691}
1692impl AstNode for RecordFieldPatList {
1693 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST }
1694 fn cast(syntax: SyntaxNode) -> Option<Self> {
1695 if Self::can_cast(syntax.kind()) {
1696 Some(Self { syntax })
1697 } else {
1698 None
1699 }
1700 }
1701 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1702}
1703impl RecordFieldPatList {
1704 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
1705 pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) }
1706 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
1707 support::children(&self.syntax)
1708 }
1709 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1710 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) }
1711 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
1712}
1713#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1714pub struct RecordFieldPat {
1715 pub(crate) syntax: SyntaxNode,
1716}
1717impl AstNode for RecordFieldPat {
1718 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT }
1719 fn cast(syntax: SyntaxNode) -> Option<Self> {
1720 if Self::can_cast(syntax.kind()) {
1721 Some(Self { syntax })
1722 } else {
1723 None
1724 }
1725 }
1726 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1727}
1728impl ast::AttrsOwner for RecordFieldPat {}
1729impl ast::NameOwner for RecordFieldPat {}
1730impl RecordFieldPat {
1731 pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) }
1732 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1733}
1734#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1735pub struct TupleStructPat {
1736 pub(crate) syntax: SyntaxNode,
1737}
1738impl AstNode for TupleStructPat {
1739 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT }
1740 fn cast(syntax: SyntaxNode) -> Option<Self> {
1741 if Self::can_cast(syntax.kind()) {
1742 Some(Self { syntax })
1743 } else {
1744 None
1745 }
1746 }
1747 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1748}
1749impl TupleStructPat {
1750 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1751 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
1752 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1753 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
1754}
1755#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1756pub struct TuplePat {
1757 pub(crate) syntax: SyntaxNode,
1758}
1759impl AstNode for TuplePat {
1760 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT }
1761 fn cast(syntax: SyntaxNode) -> Option<Self> {
1762 if Self::can_cast(syntax.kind()) {
1763 Some(Self { syntax })
1764 } else {
1765 None
1766 }
1767 }
1768 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1769}
1770impl TuplePat {
1771 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
1772 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1773 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
1774}
1775#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1776pub struct Visibility {
1777 pub(crate) syntax: SyntaxNode,
1778}
1779impl AstNode for Visibility {
1780 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
1781 fn cast(syntax: SyntaxNode) -> Option<Self> {
1782 if Self::can_cast(syntax.kind()) {
1783 Some(Self { syntax })
1784 } else {
1785 None
1786 }
1787 }
1788 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1789}
1790impl Visibility {
1791 pub fn pub_kw_token(&self) -> Option<PubKw> { support::token(&self.syntax) }
1792 pub fn super_kw_token(&self) -> Option<SuperKw> { support::token(&self.syntax) }
1793 pub fn self_kw_token(&self) -> Option<SelfKw> { support::token(&self.syntax) }
1794 pub fn crate_kw_token(&self) -> Option<CrateKw> { support::token(&self.syntax) }
1795}
1796#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1797pub struct Name {
1798 pub(crate) syntax: SyntaxNode,
1799}
1800impl AstNode for Name {
1801 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
1802 fn cast(syntax: SyntaxNode) -> Option<Self> {
1803 if Self::can_cast(syntax.kind()) {
1804 Some(Self { syntax })
1805 } else {
1806 None
1807 }
1808 }
1809 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1810}
1811impl Name {
1812 pub fn ident_token(&self) -> Option<Ident> { support::token(&self.syntax) }
1813}
1814#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1815pub struct NameRef {
1816 pub(crate) syntax: SyntaxNode,
1817}
1818impl AstNode for NameRef {
1819 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
1820 fn cast(syntax: SyntaxNode) -> Option<Self> {
1821 if Self::can_cast(syntax.kind()) {
1822 Some(Self { syntax })
1823 } else {
1824 None
1825 }
1826 }
1827 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1828}
1829impl NameRef {
1830 pub fn name_ref_token_token(&self) -> Option<NameRefToken> { support::token(&self.syntax) }
1831}
1832#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1833pub struct MacroCall {
1834 pub(crate) syntax: SyntaxNode,
1835}
1836impl AstNode for MacroCall {
1837 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
1838 fn cast(syntax: SyntaxNode) -> Option<Self> {
1839 if Self::can_cast(syntax.kind()) {
1840 Some(Self { syntax })
1841 } else {
1842 None
1843 }
1844 }
1845 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1846}
1847impl ast::NameOwner for MacroCall {}
1848impl ast::AttrsOwner for MacroCall {}
1849impl ast::DocCommentsOwner for MacroCall {}
1850impl MacroCall {
1851 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1852 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
1853 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1854 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
1855}
1856#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1857pub struct Attr {
1858 pub(crate) syntax: SyntaxNode,
1859}
1860impl AstNode for Attr {
1861 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
1862 fn cast(syntax: SyntaxNode) -> Option<Self> {
1863 if Self::can_cast(syntax.kind()) {
1864 Some(Self { syntax })
1865 } else {
1866 None
1867 }
1868 }
1869 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1870}
1871impl Attr {
1872 pub fn pound_token(&self) -> Option<Pound> { support::token(&self.syntax) }
1873 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
1874 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
1875 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1876 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
1877 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
1878 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
1879}
1880#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1881pub struct TokenTree {
1882 pub(crate) syntax: SyntaxNode,
1883}
1884impl AstNode for TokenTree {
1885 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
1886 fn cast(syntax: SyntaxNode) -> Option<Self> {
1887 if Self::can_cast(syntax.kind()) {
1888 Some(Self { syntax })
1889 } else {
1890 None
1891 }
1892 }
1893 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1894}
1895impl TokenTree {}
1896#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1897pub struct TypeParamList {
1898 pub(crate) syntax: SyntaxNode,
1899}
1900impl AstNode for TypeParamList {
1901 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST }
1902 fn cast(syntax: SyntaxNode) -> Option<Self> {
1903 if Self::can_cast(syntax.kind()) {
1904 Some(Self { syntax })
1905 } else {
1906 None
1907 }
1908 }
1909 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1910}
1911impl TypeParamList {
1912 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) }
1913 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) }
1914 pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) }
1915 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) }
1916 pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) }
1917 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) }
1918}
1919#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1920pub struct TypeParam {
1921 pub(crate) syntax: SyntaxNode,
1922}
1923impl AstNode for TypeParam {
1924 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
1925 fn cast(syntax: SyntaxNode) -> Option<Self> {
1926 if Self::can_cast(syntax.kind()) {
1927 Some(Self { syntax })
1928 } else {
1929 None
1930 }
1931 }
1932 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1933}
1934impl ast::NameOwner for TypeParam {}
1935impl ast::AttrsOwner for TypeParam {}
1936impl ast::TypeBoundsOwner for TypeParam {}
1937impl TypeParam {
1938 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
1939 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1940}
1941#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1942pub struct ConstParam {
1943 pub(crate) syntax: SyntaxNode,
1944}
1945impl AstNode for ConstParam {
1946 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
1947 fn cast(syntax: SyntaxNode) -> Option<Self> {
1948 if Self::can_cast(syntax.kind()) {
1949 Some(Self { syntax })
1950 } else {
1951 None
1952 }
1953 }
1954 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1955}
1956impl ast::NameOwner for ConstParam {}
1957impl ast::AttrsOwner for ConstParam {}
1958impl ast::TypeAscriptionOwner for ConstParam {}
1959impl ConstParam {
1960 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
1961 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
1962}
1963#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1964pub struct LifetimeParam {
1965 pub(crate) syntax: SyntaxNode,
1966}
1967impl AstNode for LifetimeParam {
1968 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
1969 fn cast(syntax: SyntaxNode) -> Option<Self> {
1970 if Self::can_cast(syntax.kind()) {
1971 Some(Self { syntax })
1972 } else {
1973 None
1974 }
1975 }
1976 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1977}
1978impl ast::AttrsOwner for LifetimeParam {}
1979impl LifetimeParam {
1980 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
1981}
1982#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1983pub struct TypeBound {
1984 pub(crate) syntax: SyntaxNode,
1985}
1986impl AstNode for TypeBound {
1987 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
1988 fn cast(syntax: SyntaxNode) -> Option<Self> {
1989 if Self::can_cast(syntax.kind()) {
1990 Some(Self { syntax })
1991 } else {
1992 None
1993 }
1994 }
1995 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1996}
1997impl TypeBound {
1998 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
1999 pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
2000 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2001}
2002#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2003pub struct TypeBoundList {
2004 pub(crate) syntax: SyntaxNode,
2005}
2006impl AstNode for TypeBoundList {
2007 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
2008 fn cast(syntax: SyntaxNode) -> Option<Self> {
2009 if Self::can_cast(syntax.kind()) {
2010 Some(Self { syntax })
2011 } else {
2012 None
2013 }
2014 }
2015 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2016}
2017impl TypeBoundList {
2018 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
2019}
2020#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2021pub struct WherePred {
2022 pub(crate) syntax: SyntaxNode,
2023}
2024impl AstNode for WherePred {
2025 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
2026 fn cast(syntax: SyntaxNode) -> Option<Self> {
2027 if Self::can_cast(syntax.kind()) {
2028 Some(Self { syntax })
2029 } else {
2030 None
2031 }
2032 }
2033 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2034}
2035impl ast::TypeBoundsOwner for WherePred {}
2036impl WherePred {
2037 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
2038 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2039}
2040#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2041pub struct WhereClause {
2042 pub(crate) syntax: SyntaxNode,
2043}
2044impl AstNode for WhereClause {
2045 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
2046 fn cast(syntax: SyntaxNode) -> Option<Self> {
2047 if Self::can_cast(syntax.kind()) {
2048 Some(Self { syntax })
2049 } else {
2050 None
2051 }
2052 }
2053 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2054}
2055impl WhereClause {
2056 pub fn where_kw_token(&self) -> Option<WhereKw> { support::token(&self.syntax) }
2057 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
2058}
2059#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2060pub struct Abi {
2061 pub(crate) syntax: SyntaxNode,
2062}
2063impl AstNode for Abi {
2064 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
2065 fn cast(syntax: SyntaxNode) -> Option<Self> {
2066 if Self::can_cast(syntax.kind()) {
2067 Some(Self { syntax })
2068 } else {
2069 None
2070 }
2071 }
2072 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2073}
2074impl Abi {
2075 pub fn string_token(&self) -> Option<String> { support::token(&self.syntax) }
2076}
2077#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2078pub struct ExprStmt {
2079 pub(crate) syntax: SyntaxNode,
2080}
2081impl AstNode for ExprStmt {
2082 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
2083 fn cast(syntax: SyntaxNode) -> Option<Self> {
2084 if Self::can_cast(syntax.kind()) {
2085 Some(Self { syntax })
2086 } else {
2087 None
2088 }
2089 }
2090 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2091}
2092impl ast::AttrsOwner for ExprStmt {}
2093impl ExprStmt {
2094 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2095 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
2096}
2097#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2098pub struct LetStmt {
2099 pub(crate) syntax: SyntaxNode,
2100}
2101impl AstNode for LetStmt {
2102 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
2103 fn cast(syntax: SyntaxNode) -> Option<Self> {
2104 if Self::can_cast(syntax.kind()) {
2105 Some(Self { syntax })
2106 } else {
2107 None
2108 }
2109 }
2110 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2111}
2112impl ast::AttrsOwner for LetStmt {}
2113impl ast::TypeAscriptionOwner for LetStmt {}
2114impl LetStmt {
2115 pub fn let_kw_token(&self) -> Option<LetKw> { support::token(&self.syntax) }
2116 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2117 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2118 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2119 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
2120}
2121#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2122pub struct Condition {
2123 pub(crate) syntax: SyntaxNode,
2124}
2125impl AstNode for Condition {
2126 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
2127 fn cast(syntax: SyntaxNode) -> Option<Self> {
2128 if Self::can_cast(syntax.kind()) {
2129 Some(Self { syntax })
2130 } else {
2131 None
2132 }
2133 }
2134 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2135}
2136impl Condition {
2137 pub fn let_kw_token(&self) -> Option<LetKw> { support::token(&self.syntax) }
2138 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2139 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2140 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2141}
2142#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2143pub struct Block {
2144 pub(crate) syntax: SyntaxNode,
2145}
2146impl AstNode for Block {
2147 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK }
2148 fn cast(syntax: SyntaxNode) -> Option<Self> {
2149 if Self::can_cast(syntax.kind()) {
2150 Some(Self { syntax })
2151 } else {
2152 None
2153 }
2154 }
2155 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2156}
2157impl ast::AttrsOwner for Block {}
2158impl ast::ModuleItemOwner for Block {}
2159impl Block {
2160 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
2161 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
2162 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2163 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
2164}
2165#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2166pub struct ParamList {
2167 pub(crate) syntax: SyntaxNode,
2168}
2169impl AstNode for ParamList {
2170 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
2171 fn cast(syntax: SyntaxNode) -> Option<Self> {
2172 if Self::can_cast(syntax.kind()) {
2173 Some(Self { syntax })
2174 } else {
2175 None
2176 }
2177 }
2178 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2179}
2180impl ParamList {
2181 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
2182 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
2183 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
2184 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
2185}
2186#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2187pub struct SelfParam {
2188 pub(crate) syntax: SyntaxNode,
2189}
2190impl AstNode for SelfParam {
2191 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
2192 fn cast(syntax: SyntaxNode) -> Option<Self> {
2193 if Self::can_cast(syntax.kind()) {
2194 Some(Self { syntax })
2195 } else {
2196 None
2197 }
2198 }
2199 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2200}
2201impl ast::TypeAscriptionOwner for SelfParam {}
2202impl ast::AttrsOwner for SelfParam {}
2203impl SelfParam {
2204 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
2205 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
2206 pub fn self_kw_token(&self) -> Option<SelfKw> { support::token(&self.syntax) }
2207}
2208#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2209pub struct Param {
2210 pub(crate) syntax: SyntaxNode,
2211}
2212impl AstNode for Param {
2213 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
2214 fn cast(syntax: SyntaxNode) -> Option<Self> {
2215 if Self::can_cast(syntax.kind()) {
2216 Some(Self { syntax })
2217 } else {
2218 None
2219 }
2220 }
2221 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2222}
2223impl ast::TypeAscriptionOwner for Param {}
2224impl ast::AttrsOwner for Param {}
2225impl Param {
2226 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2227 pub fn dotdotdot_token(&self) -> Option<Dotdotdot> { support::token(&self.syntax) }
2228}
2229#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2230pub struct UseItem {
2231 pub(crate) syntax: SyntaxNode,
2232}
2233impl AstNode for UseItem {
2234 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM }
2235 fn cast(syntax: SyntaxNode) -> Option<Self> {
2236 if Self::can_cast(syntax.kind()) {
2237 Some(Self { syntax })
2238 } else {
2239 None
2240 }
2241 }
2242 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2243}
2244impl ast::AttrsOwner for UseItem {}
2245impl ast::VisibilityOwner for UseItem {}
2246impl UseItem {
2247 pub fn use_kw_token(&self) -> Option<UseKw> { support::token(&self.syntax) }
2248 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
2249}
2250#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2251pub struct UseTree {
2252 pub(crate) syntax: SyntaxNode,
2253}
2254impl AstNode for UseTree {
2255 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
2256 fn cast(syntax: SyntaxNode) -> Option<Self> {
2257 if Self::can_cast(syntax.kind()) {
2258 Some(Self { syntax })
2259 } else {
2260 None
2261 }
2262 }
2263 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2264}
2265impl UseTree {
2266 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2267 pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) }
2268 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
2269 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2270}
2271#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2272pub struct Alias {
2273 pub(crate) syntax: SyntaxNode,
2274}
2275impl AstNode for Alias {
2276 fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS }
2277 fn cast(syntax: SyntaxNode) -> Option<Self> {
2278 if Self::can_cast(syntax.kind()) {
2279 Some(Self { syntax })
2280 } else {
2281 None
2282 }
2283 }
2284 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2285}
2286impl ast::NameOwner for Alias {}
2287impl Alias {
2288 pub fn as_kw_token(&self) -> Option<AsKw> { support::token(&self.syntax) }
2289}
2290#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2291pub struct UseTreeList {
2292 pub(crate) syntax: SyntaxNode,
2293}
2294impl AstNode for UseTreeList {
2295 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
2296 fn cast(syntax: SyntaxNode) -> Option<Self> {
2297 if Self::can_cast(syntax.kind()) {
2298 Some(Self { syntax })
2299 } else {
2300 None
2301 }
2302 }
2303 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2304}
2305impl UseTreeList {
2306 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
2307 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
2308 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
2309}
2310#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2311pub struct ExternCrateItem {
2312 pub(crate) syntax: SyntaxNode,
2313}
2314impl AstNode for ExternCrateItem {
2315 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM }
2316 fn cast(syntax: SyntaxNode) -> Option<Self> {
2317 if Self::can_cast(syntax.kind()) {
2318 Some(Self { syntax })
2319 } else {
2320 None
2321 }
2322 }
2323 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2324}
2325impl ast::AttrsOwner for ExternCrateItem {}
2326impl ast::VisibilityOwner for ExternCrateItem {}
2327impl ExternCrateItem {
2328 pub fn extern_kw_token(&self) -> Option<ExternKw> { support::token(&self.syntax) }
2329 pub fn crate_kw_token(&self) -> Option<CrateKw> { support::token(&self.syntax) }
2330 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2331 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2332}
2333#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2334pub struct ArgList {
2335 pub(crate) syntax: SyntaxNode,
2336}
2337impl AstNode for ArgList {
2338 fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST }
2339 fn cast(syntax: SyntaxNode) -> Option<Self> {
2340 if Self::can_cast(syntax.kind()) {
2341 Some(Self { syntax })
2342 } else {
2343 None
2344 }
2345 }
2346 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2347}
2348impl ArgList {
2349 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) }
2350 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
2351 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) }
2352}
2353#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2354pub struct Path {
2355 pub(crate) syntax: SyntaxNode,
2356}
2357impl AstNode for Path {
2358 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
2359 fn cast(syntax: SyntaxNode) -> Option<Self> {
2360 if Self::can_cast(syntax.kind()) {
2361 Some(Self { syntax })
2362 } else {
2363 None
2364 }
2365 }
2366 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2367}
2368impl Path {
2369 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
2370 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
2371}
2372#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2373pub struct PathSegment {
2374 pub(crate) syntax: SyntaxNode,
2375}
2376impl AstNode for PathSegment {
2377 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
2378 fn cast(syntax: SyntaxNode) -> Option<Self> {
2379 if Self::can_cast(syntax.kind()) {
2380 Some(Self { syntax })
2381 } else {
2382 None
2383 }
2384 }
2385 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2386}
2387impl PathSegment {
2388 pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) }
2389 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) }
2390 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2391 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
2392 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
2393 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
2394 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
2395 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) }
2396}
2397#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2398pub struct TypeArgList {
2399 pub(crate) syntax: SyntaxNode,
2400}
2401impl AstNode for TypeArgList {
2402 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST }
2403 fn cast(syntax: SyntaxNode) -> Option<Self> {
2404 if Self::can_cast(syntax.kind()) {
2405 Some(Self { syntax })
2406 } else {
2407 None
2408 }
2409 }
2410 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2411}
2412impl TypeArgList {
2413 pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) }
2414 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) }
2415 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
2416 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
2417 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
2418 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
2419 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
2420 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) }
2421}
2422#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2423pub struct TypeArg {
2424 pub(crate) syntax: SyntaxNode,
2425}
2426impl AstNode for TypeArg {
2427 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
2428 fn cast(syntax: SyntaxNode) -> Option<Self> {
2429 if Self::can_cast(syntax.kind()) {
2430 Some(Self { syntax })
2431 } else {
2432 None
2433 }
2434 }
2435 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2436}
2437impl TypeArg {
2438 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2439}
2440#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2441pub struct AssocTypeArg {
2442 pub(crate) syntax: SyntaxNode,
2443}
2444impl AstNode for AssocTypeArg {
2445 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
2446 fn cast(syntax: SyntaxNode) -> Option<Self> {
2447 if Self::can_cast(syntax.kind()) {
2448 Some(Self { syntax })
2449 } else {
2450 None
2451 }
2452 }
2453 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2454}
2455impl ast::TypeBoundsOwner for AssocTypeArg {}
2456impl AssocTypeArg {
2457 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2458 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2459 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2460}
2461#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2462pub struct LifetimeArg {
2463 pub(crate) syntax: SyntaxNode,
2464}
2465impl AstNode for LifetimeArg {
2466 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
2467 fn cast(syntax: SyntaxNode) -> Option<Self> {
2468 if Self::can_cast(syntax.kind()) {
2469 Some(Self { syntax })
2470 } else {
2471 None
2472 }
2473 }
2474 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2475}
2476impl LifetimeArg {
2477 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
2478}
2479#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2480pub struct ConstArg {
2481 pub(crate) syntax: SyntaxNode,
2482}
2483impl AstNode for ConstArg {
2484 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
2485 fn cast(syntax: SyntaxNode) -> Option<Self> {
2486 if Self::can_cast(syntax.kind()) {
2487 Some(Self { syntax })
2488 } else {
2489 None
2490 }
2491 }
2492 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2493}
2494impl ConstArg {
2495 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
2496 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2497 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
2498}
2499#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2500pub struct MacroItems {
2501 pub(crate) syntax: SyntaxNode,
2502}
2503impl AstNode for MacroItems {
2504 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
2505 fn cast(syntax: SyntaxNode) -> Option<Self> {
2506 if Self::can_cast(syntax.kind()) {
2507 Some(Self { syntax })
2508 } else {
2509 None
2510 }
2511 }
2512 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2513}
2514impl ast::ModuleItemOwner for MacroItems {}
2515impl ast::FnDefOwner for MacroItems {}
2516impl MacroItems {}
2517#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2518pub struct MacroStmts {
2519 pub(crate) syntax: SyntaxNode,
2520}
2521impl AstNode for MacroStmts {
2522 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS }
2523 fn cast(syntax: SyntaxNode) -> Option<Self> {
2524 if Self::can_cast(syntax.kind()) {
2525 Some(Self { syntax })
2526 } else {
2527 None
2528 }
2529 }
2530 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2531}
2532impl MacroStmts {
2533 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
2534 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2535}
2536#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2537pub struct ExternItemList {
2538 pub(crate) syntax: SyntaxNode,
2539}
2540impl AstNode for ExternItemList {
2541 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
2542 fn cast(syntax: SyntaxNode) -> Option<Self> {
2543 if Self::can_cast(syntax.kind()) {
2544 Some(Self { syntax })
2545 } else {
2546 None
2547 }
2548 }
2549 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2550}
2551impl ast::FnDefOwner for ExternItemList {}
2552impl ast::ModuleItemOwner for ExternItemList {}
2553impl ExternItemList {
2554 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) }
2555 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) }
2556 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) }
2557}
2558#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2559pub struct ExternBlock {
2560 pub(crate) syntax: SyntaxNode,
2561}
2562impl AstNode for ExternBlock {
2563 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
2564 fn cast(syntax: SyntaxNode) -> Option<Self> {
2565 if Self::can_cast(syntax.kind()) {
2566 Some(Self { syntax })
2567 } else {
2568 None
2569 }
2570 }
2571 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2572}
2573impl ExternBlock {
2574 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
2575 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) }
2576}
2577#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2578pub struct MetaItem {
2579 pub(crate) syntax: SyntaxNode,
2580}
2581impl AstNode for MetaItem {
2582 fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM }
2583 fn cast(syntax: SyntaxNode) -> Option<Self> {
2584 if Self::can_cast(syntax.kind()) {
2585 Some(Self { syntax })
2586 } else {
2587 None
2588 }
2589 }
2590 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2591}
2592impl MetaItem {
2593 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2594 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2595 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
2596 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
2597}
2598#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2599pub struct MacroDef {
2600 pub(crate) syntax: SyntaxNode,
2601}
2602impl AstNode for MacroDef {
2603 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF }
2604 fn cast(syntax: SyntaxNode) -> Option<Self> {
2605 if Self::can_cast(syntax.kind()) {
2606 Some(Self { syntax })
2607 } else {
2608 None
2609 }
2610 }
2611 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2612}
2613impl MacroDef {
2614 pub fn name(&self) -> Option<Name> { support::child(&self.syntax) }
2615 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
2616}
2617#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2618pub enum NominalDef {
2619 StructDef(StructDef),
2620 EnumDef(EnumDef),
2621 UnionDef(UnionDef),
2622}
2623impl From<StructDef> for NominalDef {
2624 fn from(node: StructDef) -> NominalDef { NominalDef::StructDef(node) }
2625}
2626impl From<EnumDef> for NominalDef {
2627 fn from(node: EnumDef) -> NominalDef { NominalDef::EnumDef(node) }
2628}
2629impl From<UnionDef> for NominalDef {
2630 fn from(node: UnionDef) -> NominalDef { NominalDef::UnionDef(node) }
2631}
2632impl AstNode for NominalDef {
2633 fn can_cast(kind: SyntaxKind) -> bool {
2634 match kind {
2635 STRUCT_DEF | ENUM_DEF | UNION_DEF => true,
2636 _ => false,
2637 }
2638 }
2639 fn cast(syntax: SyntaxNode) -> Option<Self> {
2640 let res = match syntax.kind() {
2641 STRUCT_DEF => NominalDef::StructDef(StructDef { syntax }),
2642 ENUM_DEF => NominalDef::EnumDef(EnumDef { syntax }),
2643 UNION_DEF => NominalDef::UnionDef(UnionDef { syntax }),
2644 _ => return None,
2645 };
2646 Some(res)
2647 }
2648 fn syntax(&self) -> &SyntaxNode {
2649 match self {
2650 NominalDef::StructDef(it) => &it.syntax,
2651 NominalDef::EnumDef(it) => &it.syntax,
2652 NominalDef::UnionDef(it) => &it.syntax,
2653 }
2654 }
2655}
2656impl ast::NameOwner for NominalDef {}
2657impl ast::TypeParamsOwner for NominalDef {}
2658impl ast::AttrsOwner for NominalDef {}
2659#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2660pub enum GenericParam {
2661 LifetimeParam(LifetimeParam),
2662 TypeParam(TypeParam),
2663 ConstParam(ConstParam),
2664}
2665impl From<LifetimeParam> for GenericParam {
2666 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
2667}
2668impl From<TypeParam> for GenericParam {
2669 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
2670}
2671impl From<ConstParam> for GenericParam {
2672 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
2673}
2674impl AstNode for GenericParam {
2675 fn can_cast(kind: SyntaxKind) -> bool {
2676 match kind {
2677 LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true,
2678 _ => false,
2679 }
2680 }
2681 fn cast(syntax: SyntaxNode) -> Option<Self> {
2682 let res = match syntax.kind() {
2683 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
2684 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
2685 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
2686 _ => return None,
2687 };
2688 Some(res)
2689 }
2690 fn syntax(&self) -> &SyntaxNode {
2691 match self {
2692 GenericParam::LifetimeParam(it) => &it.syntax,
2693 GenericParam::TypeParam(it) => &it.syntax,
2694 GenericParam::ConstParam(it) => &it.syntax,
2695 }
2696 }
2697}
2698#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2699pub enum GenericArg {
2700 LifetimeArg(LifetimeArg),
2701 TypeArg(TypeArg),
2702 ConstArg(ConstArg),
2703 AssocTypeArg(AssocTypeArg),
2704}
2705impl From<LifetimeArg> for GenericArg {
2706 fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) }
2707}
2708impl From<TypeArg> for GenericArg {
2709 fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
2710}
2711impl From<ConstArg> for GenericArg {
2712 fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) }
2713}
2714impl From<AssocTypeArg> for GenericArg {
2715 fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
2716}
2717impl AstNode for GenericArg {
2718 fn can_cast(kind: SyntaxKind) -> bool {
2719 match kind {
2720 LIFETIME_ARG | TYPE_ARG | CONST_ARG | ASSOC_TYPE_ARG => true,
2721 _ => false,
2722 }
2723 }
2724 fn cast(syntax: SyntaxNode) -> Option<Self> {
2725 let res = match syntax.kind() {
2726 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
2727 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
2728 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
2729 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
2730 _ => return None,
2731 };
2732 Some(res)
2733 }
2734 fn syntax(&self) -> &SyntaxNode {
2735 match self {
2736 GenericArg::LifetimeArg(it) => &it.syntax,
2737 GenericArg::TypeArg(it) => &it.syntax,
2738 GenericArg::ConstArg(it) => &it.syntax,
2739 GenericArg::AssocTypeArg(it) => &it.syntax,
2740 }
2741 }
2742}
2743#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2744pub enum TypeRef {
2745 ParenType(ParenType),
2746 TupleType(TupleType),
2747 NeverType(NeverType),
2748 PathType(PathType),
2749 PointerType(PointerType),
2750 ArrayType(ArrayType),
2751 SliceType(SliceType),
2752 ReferenceType(ReferenceType),
2753 PlaceholderType(PlaceholderType),
2754 FnPointerType(FnPointerType),
2755 ForType(ForType),
2756 ImplTraitType(ImplTraitType),
2757 DynTraitType(DynTraitType),
2758}
2759impl From<ParenType> for TypeRef {
2760 fn from(node: ParenType) -> TypeRef { TypeRef::ParenType(node) }
2761}
2762impl From<TupleType> for TypeRef {
2763 fn from(node: TupleType) -> TypeRef { TypeRef::TupleType(node) }
2764}
2765impl From<NeverType> for TypeRef {
2766 fn from(node: NeverType) -> TypeRef { TypeRef::NeverType(node) }
2767}
2768impl From<PathType> for TypeRef {
2769 fn from(node: PathType) -> TypeRef { TypeRef::PathType(node) }
2770}
2771impl From<PointerType> for TypeRef {
2772 fn from(node: PointerType) -> TypeRef { TypeRef::PointerType(node) }
2773}
2774impl From<ArrayType> for TypeRef {
2775 fn from(node: ArrayType) -> TypeRef { TypeRef::ArrayType(node) }
2776}
2777impl From<SliceType> for TypeRef {
2778 fn from(node: SliceType) -> TypeRef { TypeRef::SliceType(node) }
2779}
2780impl From<ReferenceType> for TypeRef {
2781 fn from(node: ReferenceType) -> TypeRef { TypeRef::ReferenceType(node) }
2782}
2783impl From<PlaceholderType> for TypeRef {
2784 fn from(node: PlaceholderType) -> TypeRef { TypeRef::PlaceholderType(node) }
2785}
2786impl From<FnPointerType> for TypeRef {
2787 fn from(node: FnPointerType) -> TypeRef { TypeRef::FnPointerType(node) }
2788}
2789impl From<ForType> for TypeRef {
2790 fn from(node: ForType) -> TypeRef { TypeRef::ForType(node) }
2791}
2792impl From<ImplTraitType> for TypeRef {
2793 fn from(node: ImplTraitType) -> TypeRef { TypeRef::ImplTraitType(node) }
2794}
2795impl From<DynTraitType> for TypeRef {
2796 fn from(node: DynTraitType) -> TypeRef { TypeRef::DynTraitType(node) }
2797}
2798impl AstNode for TypeRef {
2799 fn can_cast(kind: SyntaxKind) -> bool {
2800 match kind {
2801 PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
2802 | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE
2803 | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
2804 _ => false,
2805 }
2806 }
2807 fn cast(syntax: SyntaxNode) -> Option<Self> {
2808 let res = match syntax.kind() {
2809 PAREN_TYPE => TypeRef::ParenType(ParenType { syntax }),
2810 TUPLE_TYPE => TypeRef::TupleType(TupleType { syntax }),
2811 NEVER_TYPE => TypeRef::NeverType(NeverType { syntax }),
2812 PATH_TYPE => TypeRef::PathType(PathType { syntax }),
2813 POINTER_TYPE => TypeRef::PointerType(PointerType { syntax }),
2814 ARRAY_TYPE => TypeRef::ArrayType(ArrayType { syntax }),
2815 SLICE_TYPE => TypeRef::SliceType(SliceType { syntax }),
2816 REFERENCE_TYPE => TypeRef::ReferenceType(ReferenceType { syntax }),
2817 PLACEHOLDER_TYPE => TypeRef::PlaceholderType(PlaceholderType { syntax }),
2818 FN_POINTER_TYPE => TypeRef::FnPointerType(FnPointerType { syntax }),
2819 FOR_TYPE => TypeRef::ForType(ForType { syntax }),
2820 IMPL_TRAIT_TYPE => TypeRef::ImplTraitType(ImplTraitType { syntax }),
2821 DYN_TRAIT_TYPE => TypeRef::DynTraitType(DynTraitType { syntax }),
2822 _ => return None,
2823 };
2824 Some(res)
2825 }
2826 fn syntax(&self) -> &SyntaxNode {
2827 match self {
2828 TypeRef::ParenType(it) => &it.syntax,
2829 TypeRef::TupleType(it) => &it.syntax,
2830 TypeRef::NeverType(it) => &it.syntax,
2831 TypeRef::PathType(it) => &it.syntax,
2832 TypeRef::PointerType(it) => &it.syntax,
2833 TypeRef::ArrayType(it) => &it.syntax,
2834 TypeRef::SliceType(it) => &it.syntax,
2835 TypeRef::ReferenceType(it) => &it.syntax,
2836 TypeRef::PlaceholderType(it) => &it.syntax,
2837 TypeRef::FnPointerType(it) => &it.syntax,
2838 TypeRef::ForType(it) => &it.syntax,
2839 TypeRef::ImplTraitType(it) => &it.syntax,
2840 TypeRef::DynTraitType(it) => &it.syntax,
2841 }
2842 }
2843}
2844#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2845pub enum ModuleItem {
2846 StructDef(StructDef),
2847 UnionDef(UnionDef),
2848 EnumDef(EnumDef),
2849 FnDef(FnDef),
2850 TraitDef(TraitDef),
2851 TypeAliasDef(TypeAliasDef),
2852 ImplDef(ImplDef),
2853 UseItem(UseItem),
2854 ExternCrateItem(ExternCrateItem),
2855 ConstDef(ConstDef),
2856 StaticDef(StaticDef),
2857 Module(Module),
2858 MacroCall(MacroCall),
2859 ExternBlock(ExternBlock),
2860}
2861impl From<StructDef> for ModuleItem {
2862 fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) }
2863}
2864impl From<UnionDef> for ModuleItem {
2865 fn from(node: UnionDef) -> ModuleItem { ModuleItem::UnionDef(node) }
2866}
2867impl From<EnumDef> for ModuleItem {
2868 fn from(node: EnumDef) -> ModuleItem { ModuleItem::EnumDef(node) }
2869}
2870impl From<FnDef> for ModuleItem {
2871 fn from(node: FnDef) -> ModuleItem { ModuleItem::FnDef(node) }
2872}
2873impl From<TraitDef> for ModuleItem {
2874 fn from(node: TraitDef) -> ModuleItem { ModuleItem::TraitDef(node) }
2875}
2876impl From<TypeAliasDef> for ModuleItem {
2877 fn from(node: TypeAliasDef) -> ModuleItem { ModuleItem::TypeAliasDef(node) }
2878}
2879impl From<ImplDef> for ModuleItem {
2880 fn from(node: ImplDef) -> ModuleItem { ModuleItem::ImplDef(node) }
2881}
2882impl From<UseItem> for ModuleItem {
2883 fn from(node: UseItem) -> ModuleItem { ModuleItem::UseItem(node) }
2884}
2885impl From<ExternCrateItem> for ModuleItem {
2886 fn from(node: ExternCrateItem) -> ModuleItem { ModuleItem::ExternCrateItem(node) }
2887}
2888impl From<ConstDef> for ModuleItem {
2889 fn from(node: ConstDef) -> ModuleItem { ModuleItem::ConstDef(node) }
2890}
2891impl From<StaticDef> for ModuleItem {
2892 fn from(node: StaticDef) -> ModuleItem { ModuleItem::StaticDef(node) }
2893}
2894impl From<Module> for ModuleItem {
2895 fn from(node: Module) -> ModuleItem { ModuleItem::Module(node) }
2896}
2897impl From<MacroCall> for ModuleItem {
2898 fn from(node: MacroCall) -> ModuleItem { ModuleItem::MacroCall(node) }
2899}
2900impl From<ExternBlock> for ModuleItem {
2901 fn from(node: ExternBlock) -> ModuleItem { ModuleItem::ExternBlock(node) }
2902}
2903impl AstNode for ModuleItem {
2904 fn can_cast(kind: SyntaxKind) -> bool {
2905 match kind {
2906 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF
2907 | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL
2908 | EXTERN_BLOCK => true,
2909 _ => false,
2910 }
2911 }
2912 fn cast(syntax: SyntaxNode) -> Option<Self> {
2913 let res = match syntax.kind() {
2914 STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }),
2915 UNION_DEF => ModuleItem::UnionDef(UnionDef { syntax }),
2916 ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }),
2917 FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
2918 TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
2919 TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
2920 IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }),
2921 USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
2922 EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
2923 CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
2924 STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }),
2925 MODULE => ModuleItem::Module(Module { syntax }),
2926 MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }),
2927 EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }),
2928 _ => return None,
2929 };
2930 Some(res)
2931 }
2932 fn syntax(&self) -> &SyntaxNode {
2933 match self {
2934 ModuleItem::StructDef(it) => &it.syntax,
2935 ModuleItem::UnionDef(it) => &it.syntax,
2936 ModuleItem::EnumDef(it) => &it.syntax,
2937 ModuleItem::FnDef(it) => &it.syntax,
2938 ModuleItem::TraitDef(it) => &it.syntax,
2939 ModuleItem::TypeAliasDef(it) => &it.syntax,
2940 ModuleItem::ImplDef(it) => &it.syntax,
2941 ModuleItem::UseItem(it) => &it.syntax,
2942 ModuleItem::ExternCrateItem(it) => &it.syntax,
2943 ModuleItem::ConstDef(it) => &it.syntax,
2944 ModuleItem::StaticDef(it) => &it.syntax,
2945 ModuleItem::Module(it) => &it.syntax,
2946 ModuleItem::MacroCall(it) => &it.syntax,
2947 ModuleItem::ExternBlock(it) => &it.syntax,
2948 }
2949 }
2950}
2951impl ast::NameOwner for ModuleItem {}
2952impl ast::AttrsOwner for ModuleItem {}
2953impl ast::VisibilityOwner for ModuleItem {}
2954#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2955pub enum ImplItem {
2956 FnDef(FnDef),
2957 TypeAliasDef(TypeAliasDef),
2958 ConstDef(ConstDef),
2959}
2960impl From<FnDef> for ImplItem {
2961 fn from(node: FnDef) -> ImplItem { ImplItem::FnDef(node) }
2962}
2963impl From<TypeAliasDef> for ImplItem {
2964 fn from(node: TypeAliasDef) -> ImplItem { ImplItem::TypeAliasDef(node) }
2965}
2966impl From<ConstDef> for ImplItem {
2967 fn from(node: ConstDef) -> ImplItem { ImplItem::ConstDef(node) }
2968}
2969impl AstNode for ImplItem {
2970 fn can_cast(kind: SyntaxKind) -> bool {
2971 match kind {
2972 FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
2973 _ => false,
2974 }
2975 }
2976 fn cast(syntax: SyntaxNode) -> Option<Self> {
2977 let res = match syntax.kind() {
2978 FN_DEF => ImplItem::FnDef(FnDef { syntax }),
2979 TYPE_ALIAS_DEF => ImplItem::TypeAliasDef(TypeAliasDef { syntax }),
2980 CONST_DEF => ImplItem::ConstDef(ConstDef { syntax }),
2981 _ => return None,
2982 };
2983 Some(res)
2984 }
2985 fn syntax(&self) -> &SyntaxNode {
2986 match self {
2987 ImplItem::FnDef(it) => &it.syntax,
2988 ImplItem::TypeAliasDef(it) => &it.syntax,
2989 ImplItem::ConstDef(it) => &it.syntax,
2990 }
2991 }
2992}
2993impl ast::NameOwner for ImplItem {}
2994impl ast::AttrsOwner for ImplItem {}
2995#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2996pub enum ExternItem {
2997 FnDef(FnDef),
2998 StaticDef(StaticDef),
2999}
3000impl From<FnDef> for ExternItem {
3001 fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) }
3002}
3003impl From<StaticDef> for ExternItem {
3004 fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) }
3005}
3006impl AstNode for ExternItem {
3007 fn can_cast(kind: SyntaxKind) -> bool {
3008 match kind {
3009 FN_DEF | STATIC_DEF => true,
3010 _ => false,
3011 }
3012 }
3013 fn cast(syntax: SyntaxNode) -> Option<Self> {
3014 let res = match syntax.kind() {
3015 FN_DEF => ExternItem::FnDef(FnDef { syntax }),
3016 STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }),
3017 _ => return None,
3018 };
3019 Some(res)
3020 }
3021 fn syntax(&self) -> &SyntaxNode {
3022 match self {
3023 ExternItem::FnDef(it) => &it.syntax,
3024 ExternItem::StaticDef(it) => &it.syntax,
3025 }
3026 }
3027}
3028impl ast::NameOwner for ExternItem {}
3029impl ast::AttrsOwner for ExternItem {}
3030impl ast::VisibilityOwner for ExternItem {}
3031#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3032pub enum Expr {
3033 TupleExpr(TupleExpr),
3034 ArrayExpr(ArrayExpr),
3035 ParenExpr(ParenExpr),
3036 PathExpr(PathExpr),
3037 LambdaExpr(LambdaExpr),
3038 IfExpr(IfExpr),
3039 LoopExpr(LoopExpr),
3040 ForExpr(ForExpr),
3041 WhileExpr(WhileExpr),
3042 ContinueExpr(ContinueExpr),
3043 BreakExpr(BreakExpr),
3044 Label(Label),
3045 BlockExpr(BlockExpr),
3046 ReturnExpr(ReturnExpr),
3047 MatchExpr(MatchExpr),
3048 RecordLit(RecordLit),
3049 CallExpr(CallExpr),
3050 IndexExpr(IndexExpr),
3051 MethodCallExpr(MethodCallExpr),
3052 FieldExpr(FieldExpr),
3053 AwaitExpr(AwaitExpr),
3054 TryExpr(TryExpr),
3055 TryBlockExpr(TryBlockExpr),
3056 CastExpr(CastExpr),
3057 RefExpr(RefExpr),
3058 PrefixExpr(PrefixExpr),
3059 RangeExpr(RangeExpr),
3060 BinExpr(BinExpr),
3061 Literal(Literal),
3062 MacroCall(MacroCall),
3063 BoxExpr(BoxExpr),
3064}
3065impl From<TupleExpr> for Expr {
3066 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
3067}
3068impl From<ArrayExpr> for Expr {
3069 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
3070}
3071impl From<ParenExpr> for Expr {
3072 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) }
3073}
3074impl From<PathExpr> for Expr {
3075 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) }
3076}
3077impl From<LambdaExpr> for Expr {
3078 fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) }
3079}
3080impl From<IfExpr> for Expr {
3081 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
3082}
3083impl From<LoopExpr> for Expr {
3084 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) }
3085}
3086impl From<ForExpr> for Expr {
3087 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) }
3088}
3089impl From<WhileExpr> for Expr {
3090 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) }
3091}
3092impl From<ContinueExpr> for Expr {
3093 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
3094}
3095impl From<BreakExpr> for Expr {
3096 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) }
3097}
3098impl From<Label> for Expr {
3099 fn from(node: Label) -> Expr { Expr::Label(node) }
3100}
3101impl From<BlockExpr> for Expr {
3102 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
3103}
3104impl From<ReturnExpr> for Expr {
3105 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
3106}
3107impl From<MatchExpr> for Expr {
3108 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) }
3109}
3110impl From<RecordLit> for Expr {
3111 fn from(node: RecordLit) -> Expr { Expr::RecordLit(node) }
3112}
3113impl From<CallExpr> for Expr {
3114 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
3115}
3116impl From<IndexExpr> for Expr {
3117 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
3118}
3119impl From<MethodCallExpr> for Expr {
3120 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) }
3121}
3122impl From<FieldExpr> for Expr {
3123 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) }
3124}
3125impl From<AwaitExpr> for Expr {
3126 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
3127}
3128impl From<TryExpr> for Expr {
3129 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
3130}
3131impl From<TryBlockExpr> for Expr {
3132 fn from(node: TryBlockExpr) -> Expr { Expr::TryBlockExpr(node) }
3133}
3134impl From<CastExpr> for Expr {
3135 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
3136}
3137impl From<RefExpr> for Expr {
3138 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) }
3139}
3140impl From<PrefixExpr> for Expr {
3141 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) }
3142}
3143impl From<RangeExpr> for Expr {
3144 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) }
3145}
3146impl From<BinExpr> for Expr {
3147 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) }
3148}
3149impl From<Literal> for Expr {
3150 fn from(node: Literal) -> Expr { Expr::Literal(node) }
3151}
3152impl From<MacroCall> for Expr {
3153 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) }
3154}
3155impl From<BoxExpr> for Expr {
3156 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) }
3157}
3158impl AstNode for Expr {
3159 fn can_cast(kind: SyntaxKind) -> bool {
3160 match kind {
3161 TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR
3162 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
3163 | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR
3164 | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR
3165 | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL
3166 | BOX_EXPR => true,
3167 _ => false,
3168 }
3169 }
3170 fn cast(syntax: SyntaxNode) -> Option<Self> {
3171 let res = match syntax.kind() {
3172 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
3173 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
3174 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
3175 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
3176 LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }),
3177 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
3178 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
3179 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
3180 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
3181 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
3182 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
3183 LABEL => Expr::Label(Label { syntax }),
3184 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
3185 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
3186 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
3187 RECORD_LIT => Expr::RecordLit(RecordLit { syntax }),
3188 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
3189 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
3190 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
3191 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
3192 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
3193 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
3194 TRY_BLOCK_EXPR => Expr::TryBlockExpr(TryBlockExpr { syntax }),
3195 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
3196 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
3197 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
3198 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
3199 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
3200 LITERAL => Expr::Literal(Literal { syntax }),
3201 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
3202 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
3203 _ => return None,
3204 };
3205 Some(res)
3206 }
3207 fn syntax(&self) -> &SyntaxNode {
3208 match self {
3209 Expr::TupleExpr(it) => &it.syntax,
3210 Expr::ArrayExpr(it) => &it.syntax,
3211 Expr::ParenExpr(it) => &it.syntax,
3212 Expr::PathExpr(it) => &it.syntax,
3213 Expr::LambdaExpr(it) => &it.syntax,
3214 Expr::IfExpr(it) => &it.syntax,
3215 Expr::LoopExpr(it) => &it.syntax,
3216 Expr::ForExpr(it) => &it.syntax,
3217 Expr::WhileExpr(it) => &it.syntax,
3218 Expr::ContinueExpr(it) => &it.syntax,
3219 Expr::BreakExpr(it) => &it.syntax,
3220 Expr::Label(it) => &it.syntax,
3221 Expr::BlockExpr(it) => &it.syntax,
3222 Expr::ReturnExpr(it) => &it.syntax,
3223 Expr::MatchExpr(it) => &it.syntax,
3224 Expr::RecordLit(it) => &it.syntax,
3225 Expr::CallExpr(it) => &it.syntax,
3226 Expr::IndexExpr(it) => &it.syntax,
3227 Expr::MethodCallExpr(it) => &it.syntax,
3228 Expr::FieldExpr(it) => &it.syntax,
3229 Expr::AwaitExpr(it) => &it.syntax,
3230 Expr::TryExpr(it) => &it.syntax,
3231 Expr::TryBlockExpr(it) => &it.syntax,
3232 Expr::CastExpr(it) => &it.syntax,
3233 Expr::RefExpr(it) => &it.syntax,
3234 Expr::PrefixExpr(it) => &it.syntax,
3235 Expr::RangeExpr(it) => &it.syntax,
3236 Expr::BinExpr(it) => &it.syntax,
3237 Expr::Literal(it) => &it.syntax,
3238 Expr::MacroCall(it) => &it.syntax,
3239 Expr::BoxExpr(it) => &it.syntax,
3240 }
3241 }
3242}
3243impl ast::AttrsOwner for Expr {}
3244#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3245pub enum Pat {
3246 OrPat(OrPat),
3247 ParenPat(ParenPat),
3248 RefPat(RefPat),
3249 BoxPat(BoxPat),
3250 BindPat(BindPat),
3251 PlaceholderPat(PlaceholderPat),
3252 DotDotPat(DotDotPat),
3253 PathPat(PathPat),
3254 RecordPat(RecordPat),
3255 TupleStructPat(TupleStructPat),
3256 TuplePat(TuplePat),
3257 SlicePat(SlicePat),
3258 RangePat(RangePat),
3259 LiteralPat(LiteralPat),
3260 MacroPat(MacroPat),
3261}
3262impl From<OrPat> for Pat {
3263 fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
3264}
3265impl From<ParenPat> for Pat {
3266 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
3267}
3268impl From<RefPat> for Pat {
3269 fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
3270}
3271impl From<BoxPat> for Pat {
3272 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
3273}
3274impl From<BindPat> for Pat {
3275 fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
3276}
3277impl From<PlaceholderPat> for Pat {
3278 fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
3279}
3280impl From<DotDotPat> for Pat {
3281 fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
3282}
3283impl From<PathPat> for Pat {
3284 fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
3285}
3286impl From<RecordPat> for Pat {
3287 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
3288}
3289impl From<TupleStructPat> for Pat {
3290 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
3291}
3292impl From<TuplePat> for Pat {
3293 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
3294}
3295impl From<SlicePat> for Pat {
3296 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
3297}
3298impl From<RangePat> for Pat {
3299 fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
3300}
3301impl From<LiteralPat> for Pat {
3302 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
3303}
3304impl From<MacroPat> for Pat {
3305 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
3306}
3307impl AstNode for Pat {
3308 fn can_cast(kind: SyntaxKind) -> bool {
3309 match kind {
3310 OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
3311 | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
3312 | LITERAL_PAT | MACRO_PAT => true,
3313 _ => false,
3314 }
3315 }
3316 fn cast(syntax: SyntaxNode) -> Option<Self> {
3317 let res = match syntax.kind() {
3318 OR_PAT => Pat::OrPat(OrPat { syntax }),
3319 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
3320 REF_PAT => Pat::RefPat(RefPat { syntax }),
3321 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
3322 BIND_PAT => Pat::BindPat(BindPat { syntax }),
3323 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
3324 DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
3325 PATH_PAT => Pat::PathPat(PathPat { syntax }),
3326 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
3327 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
3328 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
3329 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
3330 RANGE_PAT => Pat::RangePat(RangePat { syntax }),
3331 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
3332 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
3333 _ => return None,
3334 };
3335 Some(res)
3336 }
3337 fn syntax(&self) -> &SyntaxNode {
3338 match self {
3339 Pat::OrPat(it) => &it.syntax,
3340 Pat::ParenPat(it) => &it.syntax,
3341 Pat::RefPat(it) => &it.syntax,
3342 Pat::BoxPat(it) => &it.syntax,
3343 Pat::BindPat(it) => &it.syntax,
3344 Pat::PlaceholderPat(it) => &it.syntax,
3345 Pat::DotDotPat(it) => &it.syntax,
3346 Pat::PathPat(it) => &it.syntax,
3347 Pat::RecordPat(it) => &it.syntax,
3348 Pat::TupleStructPat(it) => &it.syntax,
3349 Pat::TuplePat(it) => &it.syntax,
3350 Pat::SlicePat(it) => &it.syntax,
3351 Pat::RangePat(it) => &it.syntax,
3352 Pat::LiteralPat(it) => &it.syntax,
3353 Pat::MacroPat(it) => &it.syntax,
3354 }
3355 }
3356}
3357#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3358pub enum RecordInnerPat {
3359 RecordFieldPat(RecordFieldPat),
3360 BindPat(BindPat),
3361}
3362impl From<RecordFieldPat> for RecordInnerPat {
3363 fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) }
3364}
3365impl From<BindPat> for RecordInnerPat {
3366 fn from(node: BindPat) -> RecordInnerPat { RecordInnerPat::BindPat(node) }
3367}
3368impl AstNode for RecordInnerPat {
3369 fn can_cast(kind: SyntaxKind) -> bool {
3370 match kind {
3371 RECORD_FIELD_PAT | BIND_PAT => true,
3372 _ => false,
3373 }
3374 }
3375 fn cast(syntax: SyntaxNode) -> Option<Self> {
3376 let res = match syntax.kind() {
3377 RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }),
3378 BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }),
3379 _ => return None,
3380 };
3381 Some(res)
3382 }
3383 fn syntax(&self) -> &SyntaxNode {
3384 match self {
3385 RecordInnerPat::RecordFieldPat(it) => &it.syntax,
3386 RecordInnerPat::BindPat(it) => &it.syntax,
3387 }
3388 }
3389}
3390#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3391pub enum AttrInput {
3392 Literal(Literal),
3393 TokenTree(TokenTree),
3394}
3395impl From<Literal> for AttrInput {
3396 fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) }
3397}
3398impl From<TokenTree> for AttrInput {
3399 fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) }
3400}
3401impl AstNode for AttrInput {
3402 fn can_cast(kind: SyntaxKind) -> bool {
3403 match kind {
3404 LITERAL | TOKEN_TREE => true,
3405 _ => false,
3406 }
3407 }
3408 fn cast(syntax: SyntaxNode) -> Option<Self> {
3409 let res = match syntax.kind() {
3410 LITERAL => AttrInput::Literal(Literal { syntax }),
3411 TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }),
3412 _ => return None,
3413 };
3414 Some(res)
3415 }
3416 fn syntax(&self) -> &SyntaxNode {
3417 match self {
3418 AttrInput::Literal(it) => &it.syntax,
3419 AttrInput::TokenTree(it) => &it.syntax,
3420 }
3421 }
3422}
3423#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3424pub enum Stmt {
3425 LetStmt(LetStmt),
3426 ExprStmt(ExprStmt),
3427}
3428impl From<LetStmt> for Stmt {
3429 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3430}
3431impl From<ExprStmt> for Stmt {
3432 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
3433}
3434impl AstNode for Stmt {
3435 fn can_cast(kind: SyntaxKind) -> bool {
3436 match kind {
3437 LET_STMT | EXPR_STMT => true,
3438 _ => false,
3439 }
3440 }
3441 fn cast(syntax: SyntaxNode) -> Option<Self> {
3442 let res = match syntax.kind() {
3443 LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
3444 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
3445 _ => return None,
3446 };
3447 Some(res)
3448 }
3449 fn syntax(&self) -> &SyntaxNode {
3450 match self {
3451 Stmt::LetStmt(it) => &it.syntax,
3452 Stmt::ExprStmt(it) => &it.syntax,
3453 }
3454 }
3455}
3456#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3457pub enum FieldDefList {
3458 RecordFieldDefList(RecordFieldDefList),
3459 TupleFieldDefList(TupleFieldDefList),
3460}
3461impl From<RecordFieldDefList> for FieldDefList {
3462 fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) }
3463}
3464impl From<TupleFieldDefList> for FieldDefList {
3465 fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) }
3466}
3467impl AstNode for FieldDefList {
3468 fn can_cast(kind: SyntaxKind) -> bool {
3469 match kind {
3470 RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true,
3471 _ => false,
3472 }
3473 }
3474 fn cast(syntax: SyntaxNode) -> Option<Self> {
3475 let res = match syntax.kind() {
3476 RECORD_FIELD_DEF_LIST => {
3477 FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax })
3478 }
3479 TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
3480 _ => return None,
3481 };
3482 Some(res)
3483 }
3484 fn syntax(&self) -> &SyntaxNode {
3485 match self {
3486 FieldDefList::RecordFieldDefList(it) => &it.syntax,
3487 FieldDefList::TupleFieldDefList(it) => &it.syntax,
3488 }
3489 }
3490}
3491impl std::fmt::Display for NominalDef {
3492 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3493 std::fmt::Display::fmt(self.syntax(), f)
3494 }
3495}
3496impl std::fmt::Display for GenericParam {
3497 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3498 std::fmt::Display::fmt(self.syntax(), f)
3499 }
3500}
3501impl std::fmt::Display for GenericArg {
3502 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3503 std::fmt::Display::fmt(self.syntax(), f)
3504 }
3505}
3506impl std::fmt::Display for TypeRef {
3507 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3508 std::fmt::Display::fmt(self.syntax(), f)
3509 }
3510}
3511impl std::fmt::Display for ModuleItem {
3512 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3513 std::fmt::Display::fmt(self.syntax(), f)
3514 }
3515}
3516impl std::fmt::Display for ImplItem {
3517 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3518 std::fmt::Display::fmt(self.syntax(), f)
3519 }
3520}
3521impl std::fmt::Display for ExternItem {
3522 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3523 std::fmt::Display::fmt(self.syntax(), f)
3524 }
3525}
3526impl std::fmt::Display for Expr {
3527 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3528 std::fmt::Display::fmt(self.syntax(), f)
3529 }
3530}
3531impl std::fmt::Display for Pat {
3532 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3533 std::fmt::Display::fmt(self.syntax(), f)
3534 }
3535}
3536impl std::fmt::Display for RecordInnerPat {
3537 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3538 std::fmt::Display::fmt(self.syntax(), f)
3539 }
3540}
3541impl std::fmt::Display for AttrInput {
3542 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3543 std::fmt::Display::fmt(self.syntax(), f)
3544 }
3545}
3546impl std::fmt::Display for Stmt {
3547 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3548 std::fmt::Display::fmt(self.syntax(), f)
3549 }
3550}
3551impl std::fmt::Display for FieldDefList {
3552 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3553 std::fmt::Display::fmt(self.syntax(), f)
3554 }
3555}
3556impl std::fmt::Display for SourceFile {
3557 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3558 std::fmt::Display::fmt(self.syntax(), f)
3559 }
3560}
3561impl std::fmt::Display for FnDef {
3562 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3563 std::fmt::Display::fmt(self.syntax(), f)
3564 }
3565}
3566impl std::fmt::Display for RetType {
3567 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3568 std::fmt::Display::fmt(self.syntax(), f)
3569 }
3570}
3571impl std::fmt::Display for StructDef {
3572 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3573 std::fmt::Display::fmt(self.syntax(), f)
3574 }
3575}
3576impl std::fmt::Display for UnionDef {
3577 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3578 std::fmt::Display::fmt(self.syntax(), f)
3579 }
3580}
3581impl std::fmt::Display for RecordFieldDefList {
3582 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3583 std::fmt::Display::fmt(self.syntax(), f)
3584 }
3585}
3586impl std::fmt::Display for RecordFieldDef {
3587 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3588 std::fmt::Display::fmt(self.syntax(), f)
3589 }
3590}
3591impl std::fmt::Display for TupleFieldDefList {
3592 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3593 std::fmt::Display::fmt(self.syntax(), f)
3594 }
3595}
3596impl std::fmt::Display for TupleFieldDef {
3597 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3598 std::fmt::Display::fmt(self.syntax(), f)
3599 }
3600}
3601impl std::fmt::Display for EnumDef {
3602 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3603 std::fmt::Display::fmt(self.syntax(), f)
3604 }
3605}
3606impl std::fmt::Display for EnumVariantList {
3607 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3608 std::fmt::Display::fmt(self.syntax(), f)
3609 }
3610}
3611impl std::fmt::Display for EnumVariant {
3612 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3613 std::fmt::Display::fmt(self.syntax(), f)
3614 }
3615}
3616impl std::fmt::Display for TraitDef {
3617 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3618 std::fmt::Display::fmt(self.syntax(), f)
3619 }
3620}
3621impl std::fmt::Display for Module {
3622 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3623 std::fmt::Display::fmt(self.syntax(), f)
3624 }
3625}
3626impl std::fmt::Display for ItemList {
3627 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3628 std::fmt::Display::fmt(self.syntax(), f)
3629 }
3630}
3631impl std::fmt::Display for ConstDef {
3632 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3633 std::fmt::Display::fmt(self.syntax(), f)
3634 }
3635}
3636impl std::fmt::Display for StaticDef {
3637 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3638 std::fmt::Display::fmt(self.syntax(), f)
3639 }
3640}
3641impl std::fmt::Display for TypeAliasDef {
3642 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3643 std::fmt::Display::fmt(self.syntax(), f)
3644 }
3645}
3646impl std::fmt::Display for ImplDef {
3647 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3648 std::fmt::Display::fmt(self.syntax(), f)
3649 }
3650}
3651impl std::fmt::Display for ParenType {
3652 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3653 std::fmt::Display::fmt(self.syntax(), f)
3654 }
3655}
3656impl std::fmt::Display for TupleType {
3657 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3658 std::fmt::Display::fmt(self.syntax(), f)
3659 }
3660}
3661impl std::fmt::Display for NeverType {
3662 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3663 std::fmt::Display::fmt(self.syntax(), f)
3664 }
3665}
3666impl std::fmt::Display for PathType {
3667 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3668 std::fmt::Display::fmt(self.syntax(), f)
3669 }
3670}
3671impl std::fmt::Display for PointerType {
3672 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3673 std::fmt::Display::fmt(self.syntax(), f)
3674 }
3675}
3676impl std::fmt::Display for ArrayType {
3677 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3678 std::fmt::Display::fmt(self.syntax(), f)
3679 }
3680}
3681impl std::fmt::Display for SliceType {
3682 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3683 std::fmt::Display::fmt(self.syntax(), f)
3684 }
3685}
3686impl std::fmt::Display for ReferenceType {
3687 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3688 std::fmt::Display::fmt(self.syntax(), f)
3689 }
3690}
3691impl std::fmt::Display for PlaceholderType {
3692 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3693 std::fmt::Display::fmt(self.syntax(), f)
3694 }
3695}
3696impl std::fmt::Display for FnPointerType {
3697 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3698 std::fmt::Display::fmt(self.syntax(), f)
3699 }
3700}
3701impl std::fmt::Display for ForType {
3702 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3703 std::fmt::Display::fmt(self.syntax(), f)
3704 }
3705}
3706impl std::fmt::Display for ImplTraitType {
3707 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3708 std::fmt::Display::fmt(self.syntax(), f)
3709 }
3710}
3711impl std::fmt::Display for DynTraitType {
3712 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3713 std::fmt::Display::fmt(self.syntax(), f)
3714 }
3715}
3716impl std::fmt::Display for TupleExpr {
3717 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3718 std::fmt::Display::fmt(self.syntax(), f)
3719 }
3720}
3721impl std::fmt::Display for ArrayExpr {
3722 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3723 std::fmt::Display::fmt(self.syntax(), f)
3724 }
3725}
3726impl std::fmt::Display for ParenExpr {
3727 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3728 std::fmt::Display::fmt(self.syntax(), f)
3729 }
3730}
3731impl std::fmt::Display for PathExpr {
3732 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3733 std::fmt::Display::fmt(self.syntax(), f)
3734 }
3735}
3736impl std::fmt::Display for LambdaExpr {
3737 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3738 std::fmt::Display::fmt(self.syntax(), f)
3739 }
3740}
3741impl std::fmt::Display for IfExpr {
3742 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3743 std::fmt::Display::fmt(self.syntax(), f)
3744 }
3745}
3746impl std::fmt::Display for LoopExpr {
3747 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3748 std::fmt::Display::fmt(self.syntax(), f)
3749 }
3750}
3751impl std::fmt::Display for TryBlockExpr {
3752 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3753 std::fmt::Display::fmt(self.syntax(), f)
3754 }
3755}
3756impl std::fmt::Display for ForExpr {
3757 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3758 std::fmt::Display::fmt(self.syntax(), f)
3759 }
3760}
3761impl std::fmt::Display for WhileExpr {
3762 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3763 std::fmt::Display::fmt(self.syntax(), f)
3764 }
3765}
3766impl std::fmt::Display for ContinueExpr {
3767 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3768 std::fmt::Display::fmt(self.syntax(), f)
3769 }
3770}
3771impl std::fmt::Display for BreakExpr {
3772 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3773 std::fmt::Display::fmt(self.syntax(), f)
3774 }
3775}
3776impl std::fmt::Display for Label {
3777 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3778 std::fmt::Display::fmt(self.syntax(), f)
3779 }
3780}
3781impl std::fmt::Display for BlockExpr {
3782 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3783 std::fmt::Display::fmt(self.syntax(), f)
3784 }
3785}
3786impl std::fmt::Display for ReturnExpr {
3787 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3788 std::fmt::Display::fmt(self.syntax(), f)
3789 }
3790}
3791impl std::fmt::Display for CallExpr {
3792 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3793 std::fmt::Display::fmt(self.syntax(), f)
3794 }
3795}
3796impl std::fmt::Display for MethodCallExpr {
3797 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3798 std::fmt::Display::fmt(self.syntax(), f)
3799 }
3800}
3801impl std::fmt::Display for IndexExpr {
3802 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3803 std::fmt::Display::fmt(self.syntax(), f)
3804 }
3805}
3806impl std::fmt::Display for FieldExpr {
3807 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3808 std::fmt::Display::fmt(self.syntax(), f)
3809 }
3810}
3811impl std::fmt::Display for AwaitExpr {
3812 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3813 std::fmt::Display::fmt(self.syntax(), f)
3814 }
3815}
3816impl std::fmt::Display for TryExpr {
3817 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3818 std::fmt::Display::fmt(self.syntax(), f)
3819 }
3820}
3821impl std::fmt::Display for CastExpr {
3822 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3823 std::fmt::Display::fmt(self.syntax(), f)
3824 }
3825}
3826impl std::fmt::Display for RefExpr {
3827 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3828 std::fmt::Display::fmt(self.syntax(), f)
3829 }
3830}
3831impl std::fmt::Display for PrefixExpr {
3832 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3833 std::fmt::Display::fmt(self.syntax(), f)
3834 }
3835}
3836impl std::fmt::Display for BoxExpr {
3837 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3838 std::fmt::Display::fmt(self.syntax(), f)
3839 }
3840}
3841impl std::fmt::Display for RangeExpr {
3842 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3843 std::fmt::Display::fmt(self.syntax(), f)
3844 }
3845}
3846impl std::fmt::Display for BinExpr {
3847 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3848 std::fmt::Display::fmt(self.syntax(), f)
3849 }
3850}
3851impl std::fmt::Display for Literal {
3852 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3853 std::fmt::Display::fmt(self.syntax(), f)
3854 }
3855}
3856impl std::fmt::Display for MatchExpr {
3857 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3858 std::fmt::Display::fmt(self.syntax(), f)
3859 }
3860}
3861impl std::fmt::Display for MatchArmList {
3862 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3863 std::fmt::Display::fmt(self.syntax(), f)
3864 }
3865}
3866impl std::fmt::Display for MatchArm {
3867 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3868 std::fmt::Display::fmt(self.syntax(), f)
3869 }
3870}
3871impl std::fmt::Display for MatchGuard {
3872 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3873 std::fmt::Display::fmt(self.syntax(), f)
3874 }
3875}
3876impl std::fmt::Display for RecordLit {
3877 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3878 std::fmt::Display::fmt(self.syntax(), f)
3879 }
3880}
3881impl std::fmt::Display for RecordFieldList {
3882 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3883 std::fmt::Display::fmt(self.syntax(), f)
3884 }
3885}
3886impl std::fmt::Display for RecordField {
3887 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3888 std::fmt::Display::fmt(self.syntax(), f)
3889 }
3890}
3891impl std::fmt::Display for OrPat {
3892 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3893 std::fmt::Display::fmt(self.syntax(), f)
3894 }
3895}
3896impl std::fmt::Display for ParenPat {
3897 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3898 std::fmt::Display::fmt(self.syntax(), f)
3899 }
3900}
3901impl std::fmt::Display for RefPat {
3902 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3903 std::fmt::Display::fmt(self.syntax(), f)
3904 }
3905}
3906impl std::fmt::Display for BoxPat {
3907 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3908 std::fmt::Display::fmt(self.syntax(), f)
3909 }
3910}
3911impl std::fmt::Display for BindPat {
3912 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3913 std::fmt::Display::fmt(self.syntax(), f)
3914 }
3915}
3916impl std::fmt::Display for PlaceholderPat {
3917 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3918 std::fmt::Display::fmt(self.syntax(), f)
3919 }
3920}
3921impl std::fmt::Display for DotDotPat {
3922 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3923 std::fmt::Display::fmt(self.syntax(), f)
3924 }
3925}
3926impl std::fmt::Display for PathPat {
3927 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3928 std::fmt::Display::fmt(self.syntax(), f)
3929 }
3930}
3931impl std::fmt::Display for SlicePat {
3932 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3933 std::fmt::Display::fmt(self.syntax(), f)
3934 }
3935}
3936impl std::fmt::Display for RangePat {
3937 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3938 std::fmt::Display::fmt(self.syntax(), f)
3939 }
3940}
3941impl std::fmt::Display for LiteralPat {
3942 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3943 std::fmt::Display::fmt(self.syntax(), f)
3944 }
3945}
3946impl std::fmt::Display for MacroPat {
3947 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3948 std::fmt::Display::fmt(self.syntax(), f)
3949 }
3950}
3951impl std::fmt::Display for RecordPat {
3952 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3953 std::fmt::Display::fmt(self.syntax(), f)
3954 }
3955}
3956impl std::fmt::Display for RecordFieldPatList {
3957 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3958 std::fmt::Display::fmt(self.syntax(), f)
3959 }
3960}
3961impl std::fmt::Display for RecordFieldPat {
3962 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3963 std::fmt::Display::fmt(self.syntax(), f)
3964 }
3965}
3966impl std::fmt::Display for TupleStructPat {
3967 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3968 std::fmt::Display::fmt(self.syntax(), f)
3969 }
3970}
3971impl std::fmt::Display for TuplePat {
3972 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3973 std::fmt::Display::fmt(self.syntax(), f)
3974 }
3975}
3976impl std::fmt::Display for Visibility {
3977 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3978 std::fmt::Display::fmt(self.syntax(), f)
3979 }
3980}
3981impl std::fmt::Display for Name {
3982 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3983 std::fmt::Display::fmt(self.syntax(), f)
3984 }
3985}
3986impl std::fmt::Display for NameRef {
3987 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3988 std::fmt::Display::fmt(self.syntax(), f)
3989 }
3990}
3991impl std::fmt::Display for MacroCall {
3992 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3993 std::fmt::Display::fmt(self.syntax(), f)
3994 }
3995}
3996impl std::fmt::Display for Attr {
3997 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3998 std::fmt::Display::fmt(self.syntax(), f)
3999 }
4000}
4001impl std::fmt::Display for TokenTree {
4002 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4003 std::fmt::Display::fmt(self.syntax(), f)
4004 }
4005}
4006impl std::fmt::Display for TypeParamList {
4007 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4008 std::fmt::Display::fmt(self.syntax(), f)
4009 }
4010}
4011impl std::fmt::Display for TypeParam {
4012 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4013 std::fmt::Display::fmt(self.syntax(), f)
4014 }
4015}
4016impl std::fmt::Display for ConstParam {
4017 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4018 std::fmt::Display::fmt(self.syntax(), f)
4019 }
4020}
4021impl std::fmt::Display for LifetimeParam {
4022 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4023 std::fmt::Display::fmt(self.syntax(), f)
4024 }
4025}
4026impl std::fmt::Display for TypeBound {
4027 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4028 std::fmt::Display::fmt(self.syntax(), f)
4029 }
4030}
4031impl std::fmt::Display for TypeBoundList {
4032 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4033 std::fmt::Display::fmt(self.syntax(), f)
4034 }
4035}
4036impl std::fmt::Display for WherePred {
4037 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4038 std::fmt::Display::fmt(self.syntax(), f)
4039 }
4040}
4041impl std::fmt::Display for WhereClause {
4042 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4043 std::fmt::Display::fmt(self.syntax(), f)
4044 }
4045}
4046impl std::fmt::Display for Abi {
4047 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4048 std::fmt::Display::fmt(self.syntax(), f)
4049 }
4050}
4051impl std::fmt::Display for ExprStmt {
4052 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4053 std::fmt::Display::fmt(self.syntax(), f)
4054 }
4055}
4056impl std::fmt::Display for LetStmt {
4057 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4058 std::fmt::Display::fmt(self.syntax(), f)
4059 }
4060}
4061impl std::fmt::Display for Condition {
4062 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4063 std::fmt::Display::fmt(self.syntax(), f)
4064 }
4065}
4066impl std::fmt::Display for Block {
4067 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4068 std::fmt::Display::fmt(self.syntax(), f)
4069 }
4070}
4071impl std::fmt::Display for ParamList {
4072 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4073 std::fmt::Display::fmt(self.syntax(), f)
4074 }
4075}
4076impl std::fmt::Display for SelfParam {
4077 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4078 std::fmt::Display::fmt(self.syntax(), f)
4079 }
4080}
4081impl std::fmt::Display for Param {
4082 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4083 std::fmt::Display::fmt(self.syntax(), f)
4084 }
4085}
4086impl std::fmt::Display for UseItem {
4087 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4088 std::fmt::Display::fmt(self.syntax(), f)
4089 }
4090}
4091impl std::fmt::Display for UseTree {
4092 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4093 std::fmt::Display::fmt(self.syntax(), f)
4094 }
4095}
4096impl std::fmt::Display for Alias {
4097 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4098 std::fmt::Display::fmt(self.syntax(), f)
4099 }
4100}
4101impl std::fmt::Display for UseTreeList {
4102 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4103 std::fmt::Display::fmt(self.syntax(), f)
4104 }
4105}
4106impl std::fmt::Display for ExternCrateItem {
4107 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4108 std::fmt::Display::fmt(self.syntax(), f)
4109 }
4110}
4111impl std::fmt::Display for ArgList {
4112 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4113 std::fmt::Display::fmt(self.syntax(), f)
4114 }
4115}
4116impl std::fmt::Display for Path {
4117 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4118 std::fmt::Display::fmt(self.syntax(), f)
4119 }
4120}
4121impl std::fmt::Display for PathSegment {
4122 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4123 std::fmt::Display::fmt(self.syntax(), f)
4124 }
4125}
4126impl std::fmt::Display for TypeArgList {
4127 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4128 std::fmt::Display::fmt(self.syntax(), f)
4129 }
4130}
4131impl std::fmt::Display for TypeArg {
4132 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4133 std::fmt::Display::fmt(self.syntax(), f)
4134 }
4135}
4136impl std::fmt::Display for AssocTypeArg {
4137 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4138 std::fmt::Display::fmt(self.syntax(), f)
4139 }
4140}
4141impl std::fmt::Display for LifetimeArg {
4142 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4143 std::fmt::Display::fmt(self.syntax(), f)
4144 }
4145}
4146impl std::fmt::Display for ConstArg {
4147 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4148 std::fmt::Display::fmt(self.syntax(), f)
4149 }
4150}
4151impl std::fmt::Display for MacroItems {
4152 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4153 std::fmt::Display::fmt(self.syntax(), f)
4154 }
4155}
4156impl std::fmt::Display for MacroStmts {
4157 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4158 std::fmt::Display::fmt(self.syntax(), f)
4159 }
4160}
4161impl std::fmt::Display for ExternItemList {
4162 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4163 std::fmt::Display::fmt(self.syntax(), f)
4164 }
4165}
4166impl std::fmt::Display for ExternBlock {
4167 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4168 std::fmt::Display::fmt(self.syntax(), f)
4169 }
4170}
4171impl std::fmt::Display for MetaItem {
4172 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4173 std::fmt::Display::fmt(self.syntax(), f)
4174 }
4175}
4176impl std::fmt::Display for MacroDef {
4177 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4178 std::fmt::Display::fmt(self.syntax(), f)
4179 }
4180}