diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 2924 |
1 files changed, 1462 insertions, 1462 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 188f0df96..2cb3ad011 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -10,17 +10,6 @@ use crate::{ | |||
10 | pub struct SourceFile { | 10 | pub struct SourceFile { |
11 | pub(crate) syntax: SyntaxNode, | 11 | pub(crate) syntax: SyntaxNode, |
12 | } | 12 | } |
13 | impl 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 | } | ||
24 | impl ast::ModuleItemOwner for SourceFile {} | 13 | impl ast::ModuleItemOwner for SourceFile {} |
25 | impl ast::AttrsOwner for SourceFile {} | 14 | impl ast::AttrsOwner for SourceFile {} |
26 | impl SourceFile { | 15 | impl SourceFile { |
@@ -31,17 +20,6 @@ impl SourceFile { | |||
31 | pub struct FnDef { | 20 | pub struct FnDef { |
32 | pub(crate) syntax: SyntaxNode, | 21 | pub(crate) syntax: SyntaxNode, |
33 | } | 22 | } |
34 | impl 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 | } | ||
45 | impl ast::VisibilityOwner for FnDef {} | 23 | impl ast::VisibilityOwner for FnDef {} |
46 | impl ast::NameOwner for FnDef {} | 24 | impl ast::NameOwner for FnDef {} |
47 | impl ast::TypeParamsOwner for FnDef {} | 25 | impl ast::TypeParamsOwner for FnDef {} |
@@ -64,17 +42,6 @@ impl FnDef { | |||
64 | pub struct RetType { | 42 | pub struct RetType { |
65 | pub(crate) syntax: SyntaxNode, | 43 | pub(crate) syntax: SyntaxNode, |
66 | } | 44 | } |
67 | impl AstNode for RetType { | ||
68 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } | ||
69 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
70 | if Self::can_cast(syntax.kind()) { | ||
71 | Some(Self { syntax }) | ||
72 | } else { | ||
73 | None | ||
74 | } | ||
75 | } | ||
76 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
77 | } | ||
78 | impl RetType { | 45 | impl RetType { |
79 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } | 46 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } |
80 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 47 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
@@ -84,17 +51,6 @@ impl RetType { | |||
84 | pub struct StructDef { | 51 | pub struct StructDef { |
85 | pub(crate) syntax: SyntaxNode, | 52 | pub(crate) syntax: SyntaxNode, |
86 | } | 53 | } |
87 | impl AstNode for StructDef { | ||
88 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } | ||
89 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
90 | if Self::can_cast(syntax.kind()) { | ||
91 | Some(Self { syntax }) | ||
92 | } else { | ||
93 | None | ||
94 | } | ||
95 | } | ||
96 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
97 | } | ||
98 | impl ast::VisibilityOwner for StructDef {} | 54 | impl ast::VisibilityOwner for StructDef {} |
99 | impl ast::NameOwner for StructDef {} | 55 | impl ast::NameOwner for StructDef {} |
100 | impl ast::TypeParamsOwner for StructDef {} | 56 | impl ast::TypeParamsOwner for StructDef {} |
@@ -110,17 +66,6 @@ impl StructDef { | |||
110 | pub struct UnionDef { | 66 | pub struct UnionDef { |
111 | pub(crate) syntax: SyntaxNode, | 67 | pub(crate) syntax: SyntaxNode, |
112 | } | 68 | } |
113 | impl AstNode for UnionDef { | ||
114 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } | ||
115 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
116 | if Self::can_cast(syntax.kind()) { | ||
117 | Some(Self { syntax }) | ||
118 | } else { | ||
119 | None | ||
120 | } | ||
121 | } | ||
122 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
123 | } | ||
124 | impl ast::VisibilityOwner for UnionDef {} | 69 | impl ast::VisibilityOwner for UnionDef {} |
125 | impl ast::NameOwner for UnionDef {} | 70 | impl ast::NameOwner for UnionDef {} |
126 | impl ast::TypeParamsOwner for UnionDef {} | 71 | impl ast::TypeParamsOwner for UnionDef {} |
@@ -137,17 +82,6 @@ impl UnionDef { | |||
137 | pub struct RecordFieldDefList { | 82 | pub struct RecordFieldDefList { |
138 | pub(crate) syntax: SyntaxNode, | 83 | pub(crate) syntax: SyntaxNode, |
139 | } | 84 | } |
140 | impl AstNode for RecordFieldDefList { | ||
141 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } | ||
142 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
143 | if Self::can_cast(syntax.kind()) { | ||
144 | Some(Self { syntax }) | ||
145 | } else { | ||
146 | None | ||
147 | } | ||
148 | } | ||
149 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
150 | } | ||
151 | impl RecordFieldDefList { | 85 | impl RecordFieldDefList { |
152 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 86 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
153 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } | 87 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } |
@@ -158,17 +92,6 @@ impl RecordFieldDefList { | |||
158 | pub struct RecordFieldDef { | 92 | pub struct RecordFieldDef { |
159 | pub(crate) syntax: SyntaxNode, | 93 | pub(crate) syntax: SyntaxNode, |
160 | } | 94 | } |
161 | impl AstNode for RecordFieldDef { | ||
162 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } | ||
163 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
164 | if Self::can_cast(syntax.kind()) { | ||
165 | Some(Self { syntax }) | ||
166 | } else { | ||
167 | None | ||
168 | } | ||
169 | } | ||
170 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
171 | } | ||
172 | impl ast::VisibilityOwner for RecordFieldDef {} | 95 | impl ast::VisibilityOwner for RecordFieldDef {} |
173 | impl ast::NameOwner for RecordFieldDef {} | 96 | impl ast::NameOwner for RecordFieldDef {} |
174 | impl ast::AttrsOwner for RecordFieldDef {} | 97 | impl ast::AttrsOwner for RecordFieldDef {} |
@@ -180,17 +103,6 @@ impl RecordFieldDef {} | |||
180 | pub struct TupleFieldDefList { | 103 | pub struct TupleFieldDefList { |
181 | pub(crate) syntax: SyntaxNode, | 104 | pub(crate) syntax: SyntaxNode, |
182 | } | 105 | } |
183 | impl AstNode for TupleFieldDefList { | ||
184 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } | ||
185 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
186 | if Self::can_cast(syntax.kind()) { | ||
187 | Some(Self { syntax }) | ||
188 | } else { | ||
189 | None | ||
190 | } | ||
191 | } | ||
192 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
193 | } | ||
194 | impl TupleFieldDefList { | 106 | impl TupleFieldDefList { |
195 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 107 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
196 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } | 108 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } |
@@ -201,17 +113,6 @@ impl TupleFieldDefList { | |||
201 | pub struct TupleFieldDef { | 113 | pub struct TupleFieldDef { |
202 | pub(crate) syntax: SyntaxNode, | 114 | pub(crate) syntax: SyntaxNode, |
203 | } | 115 | } |
204 | impl AstNode for TupleFieldDef { | ||
205 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } | ||
206 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
207 | if Self::can_cast(syntax.kind()) { | ||
208 | Some(Self { syntax }) | ||
209 | } else { | ||
210 | None | ||
211 | } | ||
212 | } | ||
213 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
214 | } | ||
215 | impl ast::VisibilityOwner for TupleFieldDef {} | 116 | impl ast::VisibilityOwner for TupleFieldDef {} |
216 | impl ast::AttrsOwner for TupleFieldDef {} | 117 | impl ast::AttrsOwner for TupleFieldDef {} |
217 | impl TupleFieldDef { | 118 | impl TupleFieldDef { |
@@ -222,17 +123,6 @@ impl TupleFieldDef { | |||
222 | pub struct EnumDef { | 123 | pub struct EnumDef { |
223 | pub(crate) syntax: SyntaxNode, | 124 | pub(crate) syntax: SyntaxNode, |
224 | } | 125 | } |
225 | impl AstNode for EnumDef { | ||
226 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } | ||
227 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
228 | if Self::can_cast(syntax.kind()) { | ||
229 | Some(Self { syntax }) | ||
230 | } else { | ||
231 | None | ||
232 | } | ||
233 | } | ||
234 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
235 | } | ||
236 | impl ast::VisibilityOwner for EnumDef {} | 126 | impl ast::VisibilityOwner for EnumDef {} |
237 | impl ast::NameOwner for EnumDef {} | 127 | impl ast::NameOwner for EnumDef {} |
238 | impl ast::TypeParamsOwner for EnumDef {} | 128 | impl ast::TypeParamsOwner for EnumDef {} |
@@ -247,17 +137,6 @@ impl EnumDef { | |||
247 | pub struct EnumVariantList { | 137 | pub struct EnumVariantList { |
248 | pub(crate) syntax: SyntaxNode, | 138 | pub(crate) syntax: SyntaxNode, |
249 | } | 139 | } |
250 | impl AstNode for EnumVariantList { | ||
251 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } | ||
252 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
253 | if Self::can_cast(syntax.kind()) { | ||
254 | Some(Self { syntax }) | ||
255 | } else { | ||
256 | None | ||
257 | } | ||
258 | } | ||
259 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
260 | } | ||
261 | impl EnumVariantList { | 140 | impl EnumVariantList { |
262 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 141 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
263 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } | 142 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } |
@@ -268,17 +147,6 @@ impl EnumVariantList { | |||
268 | pub struct EnumVariant { | 147 | pub struct EnumVariant { |
269 | pub(crate) syntax: SyntaxNode, | 148 | pub(crate) syntax: SyntaxNode, |
270 | } | 149 | } |
271 | impl AstNode for EnumVariant { | ||
272 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } | ||
273 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
274 | if Self::can_cast(syntax.kind()) { | ||
275 | Some(Self { syntax }) | ||
276 | } else { | ||
277 | None | ||
278 | } | ||
279 | } | ||
280 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
281 | } | ||
282 | impl ast::VisibilityOwner for EnumVariant {} | 150 | impl ast::VisibilityOwner for EnumVariant {} |
283 | impl ast::NameOwner for EnumVariant {} | 151 | impl ast::NameOwner for EnumVariant {} |
284 | impl ast::DocCommentsOwner for EnumVariant {} | 152 | impl ast::DocCommentsOwner for EnumVariant {} |
@@ -293,17 +161,6 @@ impl EnumVariant { | |||
293 | pub struct TraitDef { | 161 | pub struct TraitDef { |
294 | pub(crate) syntax: SyntaxNode, | 162 | pub(crate) syntax: SyntaxNode, |
295 | } | 163 | } |
296 | impl AstNode for TraitDef { | ||
297 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } | ||
298 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
299 | if Self::can_cast(syntax.kind()) { | ||
300 | Some(Self { syntax }) | ||
301 | } else { | ||
302 | None | ||
303 | } | ||
304 | } | ||
305 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
306 | } | ||
307 | impl ast::VisibilityOwner for TraitDef {} | 164 | impl ast::VisibilityOwner for TraitDef {} |
308 | impl ast::NameOwner for TraitDef {} | 165 | impl ast::NameOwner for TraitDef {} |
309 | impl ast::AttrsOwner for TraitDef {} | 166 | impl ast::AttrsOwner for TraitDef {} |
@@ -321,17 +178,6 @@ impl TraitDef { | |||
321 | pub struct Module { | 178 | pub struct Module { |
322 | pub(crate) syntax: SyntaxNode, | 179 | pub(crate) syntax: SyntaxNode, |
323 | } | 180 | } |
324 | impl AstNode for Module { | ||
325 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } | ||
326 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
327 | if Self::can_cast(syntax.kind()) { | ||
328 | Some(Self { syntax }) | ||
329 | } else { | ||
330 | None | ||
331 | } | ||
332 | } | ||
333 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
334 | } | ||
335 | impl ast::VisibilityOwner for Module {} | 181 | impl ast::VisibilityOwner for Module {} |
336 | impl ast::NameOwner for Module {} | 182 | impl ast::NameOwner for Module {} |
337 | impl ast::AttrsOwner for Module {} | 183 | impl ast::AttrsOwner for Module {} |
@@ -346,17 +192,6 @@ impl Module { | |||
346 | pub struct ItemList { | 192 | pub struct ItemList { |
347 | pub(crate) syntax: SyntaxNode, | 193 | pub(crate) syntax: SyntaxNode, |
348 | } | 194 | } |
349 | impl AstNode for ItemList { | ||
350 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | ||
351 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
352 | if Self::can_cast(syntax.kind()) { | ||
353 | Some(Self { syntax }) | ||
354 | } else { | ||
355 | None | ||
356 | } | ||
357 | } | ||
358 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
359 | } | ||
360 | impl ast::ModuleItemOwner for ItemList {} | 195 | impl ast::ModuleItemOwner for ItemList {} |
361 | impl ItemList { | 196 | impl ItemList { |
362 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 197 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
@@ -368,17 +203,6 @@ impl ItemList { | |||
368 | pub struct ConstDef { | 203 | pub struct ConstDef { |
369 | pub(crate) syntax: SyntaxNode, | 204 | pub(crate) syntax: SyntaxNode, |
370 | } | 205 | } |
371 | impl AstNode for ConstDef { | ||
372 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } | ||
373 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
374 | if Self::can_cast(syntax.kind()) { | ||
375 | Some(Self { syntax }) | ||
376 | } else { | ||
377 | None | ||
378 | } | ||
379 | } | ||
380 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
381 | } | ||
382 | impl ast::VisibilityOwner for ConstDef {} | 206 | impl ast::VisibilityOwner for ConstDef {} |
383 | impl ast::NameOwner for ConstDef {} | 207 | impl ast::NameOwner for ConstDef {} |
384 | impl ast::TypeParamsOwner for ConstDef {} | 208 | impl ast::TypeParamsOwner for ConstDef {} |
@@ -397,17 +221,6 @@ impl ConstDef { | |||
397 | pub struct StaticDef { | 221 | pub struct StaticDef { |
398 | pub(crate) syntax: SyntaxNode, | 222 | pub(crate) syntax: SyntaxNode, |
399 | } | 223 | } |
400 | impl AstNode for StaticDef { | ||
401 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } | ||
402 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
403 | if Self::can_cast(syntax.kind()) { | ||
404 | Some(Self { syntax }) | ||
405 | } else { | ||
406 | None | ||
407 | } | ||
408 | } | ||
409 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
410 | } | ||
411 | impl ast::VisibilityOwner for StaticDef {} | 224 | impl ast::VisibilityOwner for StaticDef {} |
412 | impl ast::NameOwner for StaticDef {} | 225 | impl ast::NameOwner for StaticDef {} |
413 | impl ast::TypeParamsOwner for StaticDef {} | 226 | impl ast::TypeParamsOwner for StaticDef {} |
@@ -426,17 +239,6 @@ impl StaticDef { | |||
426 | pub struct TypeAliasDef { | 239 | pub struct TypeAliasDef { |
427 | pub(crate) syntax: SyntaxNode, | 240 | pub(crate) syntax: SyntaxNode, |
428 | } | 241 | } |
429 | impl AstNode for TypeAliasDef { | ||
430 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } | ||
431 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
432 | if Self::can_cast(syntax.kind()) { | ||
433 | Some(Self { syntax }) | ||
434 | } else { | ||
435 | None | ||
436 | } | ||
437 | } | ||
438 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
439 | } | ||
440 | impl ast::VisibilityOwner for TypeAliasDef {} | 242 | impl ast::VisibilityOwner for TypeAliasDef {} |
441 | impl ast::NameOwner for TypeAliasDef {} | 243 | impl ast::NameOwner for TypeAliasDef {} |
442 | impl ast::TypeParamsOwner for TypeAliasDef {} | 244 | impl ast::TypeParamsOwner for TypeAliasDef {} |
@@ -455,17 +257,6 @@ impl TypeAliasDef { | |||
455 | pub struct ImplDef { | 257 | pub struct ImplDef { |
456 | pub(crate) syntax: SyntaxNode, | 258 | pub(crate) syntax: SyntaxNode, |
457 | } | 259 | } |
458 | impl AstNode for ImplDef { | ||
459 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } | ||
460 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
461 | if Self::can_cast(syntax.kind()) { | ||
462 | Some(Self { syntax }) | ||
463 | } else { | ||
464 | None | ||
465 | } | ||
466 | } | ||
467 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
468 | } | ||
469 | impl ast::TypeParamsOwner for ImplDef {} | 260 | impl ast::TypeParamsOwner for ImplDef {} |
470 | impl ast::AttrsOwner for ImplDef {} | 261 | impl ast::AttrsOwner for ImplDef {} |
471 | impl ImplDef { | 262 | impl ImplDef { |
@@ -482,8 +273,1262 @@ impl ImplDef { | |||
482 | pub struct ParenType { | 273 | pub struct ParenType { |
483 | pub(crate) syntax: SyntaxNode, | 274 | pub(crate) syntax: SyntaxNode, |
484 | } | 275 | } |
485 | impl AstNode for ParenType { | 276 | impl ParenType { |
486 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } | 277 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
278 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
279 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
280 | } | ||
281 | |||
282 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
283 | pub struct TupleType { | ||
284 | pub(crate) syntax: SyntaxNode, | ||
285 | } | ||
286 | impl TupleType { | ||
287 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
288 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } | ||
289 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
290 | } | ||
291 | |||
292 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
293 | pub struct NeverType { | ||
294 | pub(crate) syntax: SyntaxNode, | ||
295 | } | ||
296 | impl NeverType { | ||
297 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
298 | } | ||
299 | |||
300 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
301 | pub struct PathType { | ||
302 | pub(crate) syntax: SyntaxNode, | ||
303 | } | ||
304 | impl PathType { | ||
305 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
306 | } | ||
307 | |||
308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
309 | pub struct PointerType { | ||
310 | pub(crate) syntax: SyntaxNode, | ||
311 | } | ||
312 | impl PointerType { | ||
313 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | ||
314 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
315 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
316 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
317 | } | ||
318 | |||
319 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
320 | pub struct ArrayType { | ||
321 | pub(crate) syntax: SyntaxNode, | ||
322 | } | ||
323 | impl ArrayType { | ||
324 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
325 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
326 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
327 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
328 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
329 | } | ||
330 | |||
331 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
332 | pub struct SliceType { | ||
333 | pub(crate) syntax: SyntaxNode, | ||
334 | } | ||
335 | impl SliceType { | ||
336 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
337 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
338 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
339 | } | ||
340 | |||
341 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
342 | pub struct ReferenceType { | ||
343 | pub(crate) syntax: SyntaxNode, | ||
344 | } | ||
345 | impl ReferenceType { | ||
346 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
347 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
348 | support::token(&self.syntax, T![lifetime]) | ||
349 | } | ||
350 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
351 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
352 | } | ||
353 | |||
354 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
355 | pub struct PlaceholderType { | ||
356 | pub(crate) syntax: SyntaxNode, | ||
357 | } | ||
358 | impl PlaceholderType { | ||
359 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
360 | } | ||
361 | |||
362 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
363 | pub struct FnPointerType { | ||
364 | pub(crate) syntax: SyntaxNode, | ||
365 | } | ||
366 | impl FnPointerType { | ||
367 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
368 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
369 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
370 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
371 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
372 | } | ||
373 | |||
374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
375 | pub struct ForType { | ||
376 | pub(crate) syntax: SyntaxNode, | ||
377 | } | ||
378 | impl ForType { | ||
379 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
380 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | ||
381 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
382 | } | ||
383 | |||
384 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
385 | pub struct ImplTraitType { | ||
386 | pub(crate) syntax: SyntaxNode, | ||
387 | } | ||
388 | impl ast::TypeBoundsOwner for ImplTraitType {} | ||
389 | impl ImplTraitType { | ||
390 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | ||
391 | } | ||
392 | |||
393 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
394 | pub struct DynTraitType { | ||
395 | pub(crate) syntax: SyntaxNode, | ||
396 | } | ||
397 | impl ast::TypeBoundsOwner for DynTraitType {} | ||
398 | impl DynTraitType { | ||
399 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } | ||
400 | } | ||
401 | |||
402 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
403 | pub struct TupleExpr { | ||
404 | pub(crate) syntax: SyntaxNode, | ||
405 | } | ||
406 | impl ast::AttrsOwner for TupleExpr {} | ||
407 | impl TupleExpr { | ||
408 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
409 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
410 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
411 | } | ||
412 | |||
413 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
414 | pub struct ArrayExpr { | ||
415 | pub(crate) syntax: SyntaxNode, | ||
416 | } | ||
417 | impl ast::AttrsOwner for ArrayExpr {} | ||
418 | impl ArrayExpr { | ||
419 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
420 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
421 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
422 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
423 | } | ||
424 | |||
425 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
426 | pub struct ParenExpr { | ||
427 | pub(crate) syntax: SyntaxNode, | ||
428 | } | ||
429 | impl ast::AttrsOwner for ParenExpr {} | ||
430 | impl ParenExpr { | ||
431 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
432 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
433 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
434 | } | ||
435 | |||
436 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
437 | pub struct PathExpr { | ||
438 | pub(crate) syntax: SyntaxNode, | ||
439 | } | ||
440 | impl PathExpr { | ||
441 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
442 | } | ||
443 | |||
444 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
445 | pub struct LambdaExpr { | ||
446 | pub(crate) syntax: SyntaxNode, | ||
447 | } | ||
448 | impl ast::AttrsOwner for LambdaExpr {} | ||
449 | impl LambdaExpr { | ||
450 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
451 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
452 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | ||
453 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
454 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
455 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
456 | } | ||
457 | |||
458 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
459 | pub struct IfExpr { | ||
460 | pub(crate) syntax: SyntaxNode, | ||
461 | } | ||
462 | impl ast::AttrsOwner for IfExpr {} | ||
463 | impl IfExpr { | ||
464 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
465 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
466 | } | ||
467 | |||
468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
469 | pub struct LoopExpr { | ||
470 | pub(crate) syntax: SyntaxNode, | ||
471 | } | ||
472 | impl ast::AttrsOwner for LoopExpr {} | ||
473 | impl ast::LoopBodyOwner for LoopExpr {} | ||
474 | impl LoopExpr { | ||
475 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } | ||
476 | } | ||
477 | |||
478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
479 | pub struct TryBlockExpr { | ||
480 | pub(crate) syntax: SyntaxNode, | ||
481 | } | ||
482 | impl ast::AttrsOwner for TryBlockExpr {} | ||
483 | impl TryBlockExpr { | ||
484 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
485 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
486 | } | ||
487 | |||
488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
489 | pub struct ForExpr { | ||
490 | pub(crate) syntax: SyntaxNode, | ||
491 | } | ||
492 | impl ast::AttrsOwner for ForExpr {} | ||
493 | impl ast::LoopBodyOwner for ForExpr {} | ||
494 | impl ForExpr { | ||
495 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
496 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
497 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } | ||
498 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
499 | } | ||
500 | |||
501 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
502 | pub struct WhileExpr { | ||
503 | pub(crate) syntax: SyntaxNode, | ||
504 | } | ||
505 | impl ast::AttrsOwner for WhileExpr {} | ||
506 | impl ast::LoopBodyOwner for WhileExpr {} | ||
507 | impl WhileExpr { | ||
508 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } | ||
509 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
510 | } | ||
511 | |||
512 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
513 | pub struct ContinueExpr { | ||
514 | pub(crate) syntax: SyntaxNode, | ||
515 | } | ||
516 | impl ast::AttrsOwner for ContinueExpr {} | ||
517 | impl ContinueExpr { | ||
518 | pub fn continue_token(&self) -> Option<SyntaxToken> { | ||
519 | support::token(&self.syntax, T![continue]) | ||
520 | } | ||
521 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
522 | support::token(&self.syntax, T![lifetime]) | ||
523 | } | ||
524 | } | ||
525 | |||
526 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
527 | pub struct BreakExpr { | ||
528 | pub(crate) syntax: SyntaxNode, | ||
529 | } | ||
530 | impl ast::AttrsOwner for BreakExpr {} | ||
531 | impl BreakExpr { | ||
532 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } | ||
533 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
534 | support::token(&self.syntax, T![lifetime]) | ||
535 | } | ||
536 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
537 | } | ||
538 | |||
539 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
540 | pub struct Label { | ||
541 | pub(crate) syntax: SyntaxNode, | ||
542 | } | ||
543 | impl Label { | ||
544 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
545 | support::token(&self.syntax, T![lifetime]) | ||
546 | } | ||
547 | } | ||
548 | |||
549 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
550 | pub struct BlockExpr { | ||
551 | pub(crate) syntax: SyntaxNode, | ||
552 | } | ||
553 | impl ast::AttrsOwner for BlockExpr {} | ||
554 | impl BlockExpr { | ||
555 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
556 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
557 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | ||
558 | } | ||
559 | |||
560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
561 | pub struct ReturnExpr { | ||
562 | pub(crate) syntax: SyntaxNode, | ||
563 | } | ||
564 | impl ast::AttrsOwner for ReturnExpr {} | ||
565 | impl ReturnExpr { | ||
566 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
567 | } | ||
568 | |||
569 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
570 | pub struct CallExpr { | ||
571 | pub(crate) syntax: SyntaxNode, | ||
572 | } | ||
573 | impl ast::ArgListOwner for CallExpr {} | ||
574 | impl CallExpr { | ||
575 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
576 | } | ||
577 | |||
578 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
579 | pub struct MethodCallExpr { | ||
580 | pub(crate) syntax: SyntaxNode, | ||
581 | } | ||
582 | impl ast::AttrsOwner for MethodCallExpr {} | ||
583 | impl ast::ArgListOwner for MethodCallExpr {} | ||
584 | impl MethodCallExpr { | ||
585 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
586 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
587 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
588 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
589 | } | ||
590 | |||
591 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
592 | pub struct IndexExpr { | ||
593 | pub(crate) syntax: SyntaxNode, | ||
594 | } | ||
595 | impl ast::AttrsOwner for IndexExpr {} | ||
596 | impl IndexExpr { | ||
597 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
598 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
599 | } | ||
600 | |||
601 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
602 | pub struct FieldExpr { | ||
603 | pub(crate) syntax: SyntaxNode, | ||
604 | } | ||
605 | impl ast::AttrsOwner for FieldExpr {} | ||
606 | impl FieldExpr { | ||
607 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
608 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
609 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
610 | } | ||
611 | |||
612 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
613 | pub struct AwaitExpr { | ||
614 | pub(crate) syntax: SyntaxNode, | ||
615 | } | ||
616 | impl ast::AttrsOwner for AwaitExpr {} | ||
617 | impl AwaitExpr { | ||
618 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
619 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
620 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
621 | } | ||
622 | |||
623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
624 | pub struct TryExpr { | ||
625 | pub(crate) syntax: SyntaxNode, | ||
626 | } | ||
627 | impl ast::AttrsOwner for TryExpr {} | ||
628 | impl TryExpr { | ||
629 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
630 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
631 | } | ||
632 | |||
633 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
634 | pub struct CastExpr { | ||
635 | pub(crate) syntax: SyntaxNode, | ||
636 | } | ||
637 | impl ast::AttrsOwner for CastExpr {} | ||
638 | impl CastExpr { | ||
639 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
640 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
641 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
642 | } | ||
643 | |||
644 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
645 | pub struct RefExpr { | ||
646 | pub(crate) syntax: SyntaxNode, | ||
647 | } | ||
648 | impl ast::AttrsOwner for RefExpr {} | ||
649 | impl RefExpr { | ||
650 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
651 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } | ||
652 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
653 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
654 | } | ||
655 | |||
656 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
657 | pub struct PrefixExpr { | ||
658 | pub(crate) syntax: SyntaxNode, | ||
659 | } | ||
660 | impl ast::AttrsOwner for PrefixExpr {} | ||
661 | impl PrefixExpr { | ||
662 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
663 | } | ||
664 | |||
665 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
666 | pub struct BoxExpr { | ||
667 | pub(crate) syntax: SyntaxNode, | ||
668 | } | ||
669 | impl ast::AttrsOwner for BoxExpr {} | ||
670 | impl BoxExpr { | ||
671 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | ||
672 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
673 | } | ||
674 | |||
675 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
676 | pub struct RangeExpr { | ||
677 | pub(crate) syntax: SyntaxNode, | ||
678 | } | ||
679 | impl ast::AttrsOwner for RangeExpr {} | ||
680 | impl RangeExpr {} | ||
681 | |||
682 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
683 | pub struct BinExpr { | ||
684 | pub(crate) syntax: SyntaxNode, | ||
685 | } | ||
686 | impl ast::AttrsOwner for BinExpr {} | ||
687 | impl BinExpr {} | ||
688 | |||
689 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
690 | pub struct Literal { | ||
691 | pub(crate) syntax: SyntaxNode, | ||
692 | } | ||
693 | impl Literal {} | ||
694 | |||
695 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
696 | pub struct MatchExpr { | ||
697 | pub(crate) syntax: SyntaxNode, | ||
698 | } | ||
699 | impl ast::AttrsOwner for MatchExpr {} | ||
700 | impl MatchExpr { | ||
701 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } | ||
702 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
703 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | ||
704 | } | ||
705 | |||
706 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
707 | pub struct MatchArmList { | ||
708 | pub(crate) syntax: SyntaxNode, | ||
709 | } | ||
710 | impl ast::AttrsOwner for MatchArmList {} | ||
711 | impl MatchArmList { | ||
712 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
713 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | ||
714 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
715 | } | ||
716 | |||
717 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
718 | pub struct MatchArm { | ||
719 | pub(crate) syntax: SyntaxNode, | ||
720 | } | ||
721 | impl ast::AttrsOwner for MatchArm {} | ||
722 | impl MatchArm { | ||
723 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
724 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | ||
725 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } | ||
726 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
727 | } | ||
728 | |||
729 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
730 | pub struct MatchGuard { | ||
731 | pub(crate) syntax: SyntaxNode, | ||
732 | } | ||
733 | impl MatchGuard { | ||
734 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
735 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
736 | } | ||
737 | |||
738 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
739 | pub struct RecordLit { | ||
740 | pub(crate) syntax: SyntaxNode, | ||
741 | } | ||
742 | impl RecordLit { | ||
743 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
744 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | ||
745 | } | ||
746 | |||
747 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
748 | pub struct RecordFieldList { | ||
749 | pub(crate) syntax: SyntaxNode, | ||
750 | } | ||
751 | impl RecordFieldList { | ||
752 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
753 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } | ||
754 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
755 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
756 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
757 | } | ||
758 | |||
759 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
760 | pub struct RecordField { | ||
761 | pub(crate) syntax: SyntaxNode, | ||
762 | } | ||
763 | impl ast::AttrsOwner for RecordField {} | ||
764 | impl RecordField { | ||
765 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
766 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
767 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
768 | } | ||
769 | |||
770 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
771 | pub struct OrPat { | ||
772 | pub(crate) syntax: SyntaxNode, | ||
773 | } | ||
774 | impl OrPat { | ||
775 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
776 | } | ||
777 | |||
778 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
779 | pub struct ParenPat { | ||
780 | pub(crate) syntax: SyntaxNode, | ||
781 | } | ||
782 | impl ParenPat { | ||
783 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
784 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
785 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
786 | } | ||
787 | |||
788 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
789 | pub struct RefPat { | ||
790 | pub(crate) syntax: SyntaxNode, | ||
791 | } | ||
792 | impl RefPat { | ||
793 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
794 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
795 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
796 | } | ||
797 | |||
798 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
799 | pub struct BoxPat { | ||
800 | pub(crate) syntax: SyntaxNode, | ||
801 | } | ||
802 | impl BoxPat { | ||
803 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | ||
804 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
805 | } | ||
806 | |||
807 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
808 | pub struct BindPat { | ||
809 | pub(crate) syntax: SyntaxNode, | ||
810 | } | ||
811 | impl ast::AttrsOwner for BindPat {} | ||
812 | impl ast::NameOwner for BindPat {} | ||
813 | impl BindPat { | ||
814 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
815 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
816 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
817 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
818 | } | ||
819 | |||
820 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
821 | pub struct PlaceholderPat { | ||
822 | pub(crate) syntax: SyntaxNode, | ||
823 | } | ||
824 | impl PlaceholderPat { | ||
825 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
826 | } | ||
827 | |||
828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
829 | pub struct DotDotPat { | ||
830 | pub(crate) syntax: SyntaxNode, | ||
831 | } | ||
832 | impl DotDotPat { | ||
833 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
834 | } | ||
835 | |||
836 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
837 | pub struct PathPat { | ||
838 | pub(crate) syntax: SyntaxNode, | ||
839 | } | ||
840 | impl PathPat { | ||
841 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
842 | } | ||
843 | |||
844 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
845 | pub struct SlicePat { | ||
846 | pub(crate) syntax: SyntaxNode, | ||
847 | } | ||
848 | impl SlicePat { | ||
849 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
850 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
851 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
852 | } | ||
853 | |||
854 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
855 | pub struct RangePat { | ||
856 | pub(crate) syntax: SyntaxNode, | ||
857 | } | ||
858 | impl RangePat {} | ||
859 | |||
860 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
861 | pub struct LiteralPat { | ||
862 | pub(crate) syntax: SyntaxNode, | ||
863 | } | ||
864 | impl LiteralPat { | ||
865 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | ||
866 | } | ||
867 | |||
868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
869 | pub struct MacroPat { | ||
870 | pub(crate) syntax: SyntaxNode, | ||
871 | } | ||
872 | impl MacroPat { | ||
873 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | ||
874 | } | ||
875 | |||
876 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
877 | pub struct RecordPat { | ||
878 | pub(crate) syntax: SyntaxNode, | ||
879 | } | ||
880 | impl RecordPat { | ||
881 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { | ||
882 | support::child(&self.syntax) | ||
883 | } | ||
884 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
885 | } | ||
886 | |||
887 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
888 | pub struct RecordFieldPatList { | ||
889 | pub(crate) syntax: SyntaxNode, | ||
890 | } | ||
891 | impl RecordFieldPatList { | ||
892 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
893 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } | ||
894 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | ||
895 | support::children(&self.syntax) | ||
896 | } | ||
897 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | ||
898 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
899 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
900 | } | ||
901 | |||
902 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
903 | pub struct RecordFieldPat { | ||
904 | pub(crate) syntax: SyntaxNode, | ||
905 | } | ||
906 | impl ast::AttrsOwner for RecordFieldPat {} | ||
907 | impl RecordFieldPat { | ||
908 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
909 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
910 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
911 | } | ||
912 | |||
913 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
914 | pub struct TupleStructPat { | ||
915 | pub(crate) syntax: SyntaxNode, | ||
916 | } | ||
917 | impl TupleStructPat { | ||
918 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
919 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
920 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
921 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
922 | } | ||
923 | |||
924 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
925 | pub struct TuplePat { | ||
926 | pub(crate) syntax: SyntaxNode, | ||
927 | } | ||
928 | impl TuplePat { | ||
929 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
930 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
931 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
932 | } | ||
933 | |||
934 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
935 | pub struct Visibility { | ||
936 | pub(crate) syntax: SyntaxNode, | ||
937 | } | ||
938 | impl Visibility { | ||
939 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } | ||
940 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
941 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
942 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
943 | } | ||
944 | |||
945 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
946 | pub struct Name { | ||
947 | pub(crate) syntax: SyntaxNode, | ||
948 | } | ||
949 | impl Name { | ||
950 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
951 | } | ||
952 | |||
953 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
954 | pub struct NameRef { | ||
955 | pub(crate) syntax: SyntaxNode, | ||
956 | } | ||
957 | impl NameRef {} | ||
958 | |||
959 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
960 | pub struct MacroCall { | ||
961 | pub(crate) syntax: SyntaxNode, | ||
962 | } | ||
963 | impl ast::NameOwner for MacroCall {} | ||
964 | impl ast::AttrsOwner for MacroCall {} | ||
965 | impl ast::DocCommentsOwner for MacroCall {} | ||
966 | impl MacroCall { | ||
967 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
968 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
969 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
970 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
971 | } | ||
972 | |||
973 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
974 | pub struct Attr { | ||
975 | pub(crate) syntax: SyntaxNode, | ||
976 | } | ||
977 | impl Attr { | ||
978 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } | ||
979 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
980 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
981 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
982 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
983 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | ||
984 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
985 | } | ||
986 | |||
987 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
988 | pub struct TokenTree { | ||
989 | pub(crate) syntax: SyntaxNode, | ||
990 | } | ||
991 | impl TokenTree {} | ||
992 | |||
993 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
994 | pub struct TypeParamList { | ||
995 | pub(crate) syntax: SyntaxNode, | ||
996 | } | ||
997 | impl TypeParamList { | ||
998 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
999 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } | ||
1000 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | ||
1001 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | ||
1002 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | ||
1003 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
1004 | } | ||
1005 | |||
1006 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1007 | pub struct TypeParam { | ||
1008 | pub(crate) syntax: SyntaxNode, | ||
1009 | } | ||
1010 | impl ast::NameOwner for TypeParam {} | ||
1011 | impl ast::AttrsOwner for TypeParam {} | ||
1012 | impl ast::TypeBoundsOwner for TypeParam {} | ||
1013 | impl TypeParam { | ||
1014 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1015 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1016 | } | ||
1017 | |||
1018 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1019 | pub struct ConstParam { | ||
1020 | pub(crate) syntax: SyntaxNode, | ||
1021 | } | ||
1022 | impl ast::NameOwner for ConstParam {} | ||
1023 | impl ast::AttrsOwner for ConstParam {} | ||
1024 | impl ast::TypeAscriptionOwner for ConstParam {} | ||
1025 | impl ConstParam { | ||
1026 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1027 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1028 | } | ||
1029 | |||
1030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1031 | pub struct LifetimeParam { | ||
1032 | pub(crate) syntax: SyntaxNode, | ||
1033 | } | ||
1034 | impl ast::AttrsOwner for LifetimeParam {} | ||
1035 | impl LifetimeParam { | ||
1036 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1037 | support::token(&self.syntax, T![lifetime]) | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1042 | pub struct TypeBound { | ||
1043 | pub(crate) syntax: SyntaxNode, | ||
1044 | } | ||
1045 | impl TypeBound { | ||
1046 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1047 | support::token(&self.syntax, T![lifetime]) | ||
1048 | } | ||
1049 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1050 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1051 | } | ||
1052 | |||
1053 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1054 | pub struct TypeBoundList { | ||
1055 | pub(crate) syntax: SyntaxNode, | ||
1056 | } | ||
1057 | impl TypeBoundList { | ||
1058 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | ||
1059 | } | ||
1060 | |||
1061 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1062 | pub struct WherePred { | ||
1063 | pub(crate) syntax: SyntaxNode, | ||
1064 | } | ||
1065 | impl ast::TypeBoundsOwner for WherePred {} | ||
1066 | impl WherePred { | ||
1067 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1068 | support::token(&self.syntax, T![lifetime]) | ||
1069 | } | ||
1070 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1071 | } | ||
1072 | |||
1073 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1074 | pub struct WhereClause { | ||
1075 | pub(crate) syntax: SyntaxNode, | ||
1076 | } | ||
1077 | impl WhereClause { | ||
1078 | pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } | ||
1079 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } | ||
1080 | } | ||
1081 | |||
1082 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1083 | pub struct Abi { | ||
1084 | pub(crate) syntax: SyntaxNode, | ||
1085 | } | ||
1086 | impl Abi {} | ||
1087 | |||
1088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1089 | pub struct ExprStmt { | ||
1090 | pub(crate) syntax: SyntaxNode, | ||
1091 | } | ||
1092 | impl ast::AttrsOwner for ExprStmt {} | ||
1093 | impl ExprStmt { | ||
1094 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1095 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1096 | } | ||
1097 | |||
1098 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1099 | pub struct LetStmt { | ||
1100 | pub(crate) syntax: SyntaxNode, | ||
1101 | } | ||
1102 | impl ast::AttrsOwner for LetStmt {} | ||
1103 | impl ast::TypeAscriptionOwner for LetStmt {} | ||
1104 | impl LetStmt { | ||
1105 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | ||
1106 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1107 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1108 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1109 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1110 | } | ||
1111 | |||
1112 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1113 | pub struct Condition { | ||
1114 | pub(crate) syntax: SyntaxNode, | ||
1115 | } | ||
1116 | impl Condition { | ||
1117 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | ||
1118 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1119 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1120 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1121 | } | ||
1122 | |||
1123 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1124 | pub struct Block { | ||
1125 | pub(crate) syntax: SyntaxNode, | ||
1126 | } | ||
1127 | impl ast::AttrsOwner for Block {} | ||
1128 | impl ast::ModuleItemOwner for Block {} | ||
1129 | impl Block { | ||
1130 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1131 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
1132 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1133 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1134 | } | ||
1135 | |||
1136 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1137 | pub struct ParamList { | ||
1138 | pub(crate) syntax: SyntaxNode, | ||
1139 | } | ||
1140 | impl ParamList { | ||
1141 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1142 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | ||
1143 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
1144 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1145 | } | ||
1146 | |||
1147 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1148 | pub struct SelfParam { | ||
1149 | pub(crate) syntax: SyntaxNode, | ||
1150 | } | ||
1151 | impl ast::TypeAscriptionOwner for SelfParam {} | ||
1152 | impl ast::AttrsOwner for SelfParam {} | ||
1153 | impl SelfParam { | ||
1154 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
1155 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1156 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1157 | support::token(&self.syntax, T![lifetime]) | ||
1158 | } | ||
1159 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1160 | } | ||
1161 | |||
1162 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1163 | pub struct Param { | ||
1164 | pub(crate) syntax: SyntaxNode, | ||
1165 | } | ||
1166 | impl ast::TypeAscriptionOwner for Param {} | ||
1167 | impl ast::AttrsOwner for Param {} | ||
1168 | impl Param { | ||
1169 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1170 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
1171 | } | ||
1172 | |||
1173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1174 | pub struct UseItem { | ||
1175 | pub(crate) syntax: SyntaxNode, | ||
1176 | } | ||
1177 | impl ast::AttrsOwner for UseItem {} | ||
1178 | impl ast::VisibilityOwner for UseItem {} | ||
1179 | impl UseItem { | ||
1180 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } | ||
1181 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | ||
1182 | } | ||
1183 | |||
1184 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1185 | pub struct UseTree { | ||
1186 | pub(crate) syntax: SyntaxNode, | ||
1187 | } | ||
1188 | impl UseTree { | ||
1189 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1190 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | ||
1191 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | ||
1192 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
1193 | } | ||
1194 | |||
1195 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1196 | pub struct Alias { | ||
1197 | pub(crate) syntax: SyntaxNode, | ||
1198 | } | ||
1199 | impl ast::NameOwner for Alias {} | ||
1200 | impl Alias { | ||
1201 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
1202 | } | ||
1203 | |||
1204 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1205 | pub struct UseTreeList { | ||
1206 | pub(crate) syntax: SyntaxNode, | ||
1207 | } | ||
1208 | impl UseTreeList { | ||
1209 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1210 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | ||
1211 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1212 | } | ||
1213 | |||
1214 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1215 | pub struct ExternCrateItem { | ||
1216 | pub(crate) syntax: SyntaxNode, | ||
1217 | } | ||
1218 | impl ast::AttrsOwner for ExternCrateItem {} | ||
1219 | impl ast::VisibilityOwner for ExternCrateItem {} | ||
1220 | impl ExternCrateItem { | ||
1221 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | ||
1222 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
1223 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1224 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
1225 | } | ||
1226 | |||
1227 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1228 | pub struct ArgList { | ||
1229 | pub(crate) syntax: SyntaxNode, | ||
1230 | } | ||
1231 | impl ArgList { | ||
1232 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1233 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
1234 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1235 | } | ||
1236 | |||
1237 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1238 | pub struct Path { | ||
1239 | pub(crate) syntax: SyntaxNode, | ||
1240 | } | ||
1241 | impl Path { | ||
1242 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
1243 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1244 | } | ||
1245 | |||
1246 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1247 | pub struct PathSegment { | ||
1248 | pub(crate) syntax: SyntaxNode, | ||
1249 | } | ||
1250 | impl PathSegment { | ||
1251 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
1252 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
1253 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1254 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
1255 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
1256 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
1257 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | ||
1258 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
1259 | } | ||
1260 | |||
1261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1262 | pub struct TypeArgList { | ||
1263 | pub(crate) syntax: SyntaxNode, | ||
1264 | } | ||
1265 | impl TypeArgList { | ||
1266 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
1267 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
1268 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } | ||
1269 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } | ||
1270 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } | ||
1271 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } | ||
1272 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } | ||
1273 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
1274 | } | ||
1275 | |||
1276 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1277 | pub struct TypeArg { | ||
1278 | pub(crate) syntax: SyntaxNode, | ||
1279 | } | ||
1280 | impl TypeArg { | ||
1281 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1282 | } | ||
1283 | |||
1284 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1285 | pub struct AssocTypeArg { | ||
1286 | pub(crate) syntax: SyntaxNode, | ||
1287 | } | ||
1288 | impl ast::TypeBoundsOwner for AssocTypeArg {} | ||
1289 | impl AssocTypeArg { | ||
1290 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1291 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1292 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1293 | } | ||
1294 | |||
1295 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1296 | pub struct LifetimeArg { | ||
1297 | pub(crate) syntax: SyntaxNode, | ||
1298 | } | ||
1299 | impl LifetimeArg { | ||
1300 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1301 | support::token(&self.syntax, T![lifetime]) | ||
1302 | } | ||
1303 | } | ||
1304 | |||
1305 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1306 | pub struct ConstArg { | ||
1307 | pub(crate) syntax: SyntaxNode, | ||
1308 | } | ||
1309 | impl ConstArg { | ||
1310 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | ||
1311 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1312 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
1313 | } | ||
1314 | |||
1315 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1316 | pub struct MacroItems { | ||
1317 | pub(crate) syntax: SyntaxNode, | ||
1318 | } | ||
1319 | impl ast::ModuleItemOwner for MacroItems {} | ||
1320 | impl MacroItems {} | ||
1321 | |||
1322 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1323 | pub struct MacroStmts { | ||
1324 | pub(crate) syntax: SyntaxNode, | ||
1325 | } | ||
1326 | impl MacroStmts { | ||
1327 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
1328 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1329 | } | ||
1330 | |||
1331 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1332 | pub struct ExternItemList { | ||
1333 | pub(crate) syntax: SyntaxNode, | ||
1334 | } | ||
1335 | impl ast::ModuleItemOwner for ExternItemList {} | ||
1336 | impl ExternItemList { | ||
1337 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1338 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | ||
1339 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1340 | } | ||
1341 | |||
1342 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1343 | pub struct ExternBlock { | ||
1344 | pub(crate) syntax: SyntaxNode, | ||
1345 | } | ||
1346 | impl ExternBlock { | ||
1347 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
1348 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | ||
1349 | } | ||
1350 | |||
1351 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1352 | pub struct MetaItem { | ||
1353 | pub(crate) syntax: SyntaxNode, | ||
1354 | } | ||
1355 | impl MetaItem { | ||
1356 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1357 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1358 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | ||
1359 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | ||
1360 | } | ||
1361 | |||
1362 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1363 | pub struct MacroDef { | ||
1364 | pub(crate) syntax: SyntaxNode, | ||
1365 | } | ||
1366 | impl MacroDef { | ||
1367 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } | ||
1368 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
1369 | } | ||
1370 | |||
1371 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1372 | pub enum NominalDef { | ||
1373 | StructDef(StructDef), | ||
1374 | EnumDef(EnumDef), | ||
1375 | UnionDef(UnionDef), | ||
1376 | } | ||
1377 | impl ast::NameOwner for NominalDef {} | ||
1378 | impl ast::TypeParamsOwner for NominalDef {} | ||
1379 | impl ast::AttrsOwner for NominalDef {} | ||
1380 | |||
1381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1382 | pub enum GenericParam { | ||
1383 | LifetimeParam(LifetimeParam), | ||
1384 | TypeParam(TypeParam), | ||
1385 | ConstParam(ConstParam), | ||
1386 | } | ||
1387 | |||
1388 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1389 | pub enum GenericArg { | ||
1390 | LifetimeArg(LifetimeArg), | ||
1391 | TypeArg(TypeArg), | ||
1392 | ConstArg(ConstArg), | ||
1393 | AssocTypeArg(AssocTypeArg), | ||
1394 | } | ||
1395 | |||
1396 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1397 | pub enum TypeRef { | ||
1398 | ParenType(ParenType), | ||
1399 | TupleType(TupleType), | ||
1400 | NeverType(NeverType), | ||
1401 | PathType(PathType), | ||
1402 | PointerType(PointerType), | ||
1403 | ArrayType(ArrayType), | ||
1404 | SliceType(SliceType), | ||
1405 | ReferenceType(ReferenceType), | ||
1406 | PlaceholderType(PlaceholderType), | ||
1407 | FnPointerType(FnPointerType), | ||
1408 | ForType(ForType), | ||
1409 | ImplTraitType(ImplTraitType), | ||
1410 | DynTraitType(DynTraitType), | ||
1411 | } | ||
1412 | |||
1413 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1414 | pub enum ModuleItem { | ||
1415 | StructDef(StructDef), | ||
1416 | UnionDef(UnionDef), | ||
1417 | EnumDef(EnumDef), | ||
1418 | FnDef(FnDef), | ||
1419 | TraitDef(TraitDef), | ||
1420 | TypeAliasDef(TypeAliasDef), | ||
1421 | ImplDef(ImplDef), | ||
1422 | UseItem(UseItem), | ||
1423 | ExternCrateItem(ExternCrateItem), | ||
1424 | ConstDef(ConstDef), | ||
1425 | StaticDef(StaticDef), | ||
1426 | Module(Module), | ||
1427 | MacroCall(MacroCall), | ||
1428 | ExternBlock(ExternBlock), | ||
1429 | } | ||
1430 | impl ast::NameOwner for ModuleItem {} | ||
1431 | impl ast::AttrsOwner for ModuleItem {} | ||
1432 | impl ast::VisibilityOwner for ModuleItem {} | ||
1433 | |||
1434 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1435 | pub enum ImplItem { | ||
1436 | FnDef(FnDef), | ||
1437 | TypeAliasDef(TypeAliasDef), | ||
1438 | ConstDef(ConstDef), | ||
1439 | } | ||
1440 | impl ast::NameOwner for ImplItem {} | ||
1441 | impl ast::AttrsOwner for ImplItem {} | ||
1442 | |||
1443 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1444 | pub enum ExternItem { | ||
1445 | FnDef(FnDef), | ||
1446 | StaticDef(StaticDef), | ||
1447 | } | ||
1448 | impl ast::NameOwner for ExternItem {} | ||
1449 | impl ast::AttrsOwner for ExternItem {} | ||
1450 | impl ast::VisibilityOwner for ExternItem {} | ||
1451 | |||
1452 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1453 | pub enum Expr { | ||
1454 | TupleExpr(TupleExpr), | ||
1455 | ArrayExpr(ArrayExpr), | ||
1456 | ParenExpr(ParenExpr), | ||
1457 | PathExpr(PathExpr), | ||
1458 | LambdaExpr(LambdaExpr), | ||
1459 | IfExpr(IfExpr), | ||
1460 | LoopExpr(LoopExpr), | ||
1461 | ForExpr(ForExpr), | ||
1462 | WhileExpr(WhileExpr), | ||
1463 | ContinueExpr(ContinueExpr), | ||
1464 | BreakExpr(BreakExpr), | ||
1465 | Label(Label), | ||
1466 | BlockExpr(BlockExpr), | ||
1467 | ReturnExpr(ReturnExpr), | ||
1468 | MatchExpr(MatchExpr), | ||
1469 | RecordLit(RecordLit), | ||
1470 | CallExpr(CallExpr), | ||
1471 | IndexExpr(IndexExpr), | ||
1472 | MethodCallExpr(MethodCallExpr), | ||
1473 | FieldExpr(FieldExpr), | ||
1474 | AwaitExpr(AwaitExpr), | ||
1475 | TryExpr(TryExpr), | ||
1476 | TryBlockExpr(TryBlockExpr), | ||
1477 | CastExpr(CastExpr), | ||
1478 | RefExpr(RefExpr), | ||
1479 | PrefixExpr(PrefixExpr), | ||
1480 | RangeExpr(RangeExpr), | ||
1481 | BinExpr(BinExpr), | ||
1482 | Literal(Literal), | ||
1483 | MacroCall(MacroCall), | ||
1484 | BoxExpr(BoxExpr), | ||
1485 | } | ||
1486 | impl ast::AttrsOwner for Expr {} | ||
1487 | |||
1488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1489 | pub enum Pat { | ||
1490 | OrPat(OrPat), | ||
1491 | ParenPat(ParenPat), | ||
1492 | RefPat(RefPat), | ||
1493 | BoxPat(BoxPat), | ||
1494 | BindPat(BindPat), | ||
1495 | PlaceholderPat(PlaceholderPat), | ||
1496 | DotDotPat(DotDotPat), | ||
1497 | PathPat(PathPat), | ||
1498 | RecordPat(RecordPat), | ||
1499 | TupleStructPat(TupleStructPat), | ||
1500 | TuplePat(TuplePat), | ||
1501 | SlicePat(SlicePat), | ||
1502 | RangePat(RangePat), | ||
1503 | LiteralPat(LiteralPat), | ||
1504 | MacroPat(MacroPat), | ||
1505 | } | ||
1506 | |||
1507 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1508 | pub enum RecordInnerPat { | ||
1509 | RecordFieldPat(RecordFieldPat), | ||
1510 | BindPat(BindPat), | ||
1511 | } | ||
1512 | |||
1513 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1514 | pub enum AttrInput { | ||
1515 | Literal(Literal), | ||
1516 | TokenTree(TokenTree), | ||
1517 | } | ||
1518 | |||
1519 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1520 | pub enum Stmt { | ||
1521 | LetStmt(LetStmt), | ||
1522 | ExprStmt(ExprStmt), | ||
1523 | } | ||
1524 | |||
1525 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1526 | pub enum FieldDefList { | ||
1527 | RecordFieldDefList(RecordFieldDefList), | ||
1528 | TupleFieldDefList(TupleFieldDefList), | ||
1529 | } | ||
1530 | impl AstNode for SourceFile { | ||
1531 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | ||
487 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1532 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
488 | if Self::can_cast(syntax.kind()) { | 1533 | if Self::can_cast(syntax.kind()) { |
489 | Some(Self { syntax }) | 1534 | Some(Self { syntax }) |
@@ -493,18 +1538,30 @@ impl AstNode for ParenType { | |||
493 | } | 1538 | } |
494 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1539 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
495 | } | 1540 | } |
496 | impl ParenType { | 1541 | impl AstNode for FnDef { |
497 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1542 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF } |
498 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1543 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
499 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1544 | if Self::can_cast(syntax.kind()) { |
1545 | Some(Self { syntax }) | ||
1546 | } else { | ||
1547 | None | ||
1548 | } | ||
1549 | } | ||
1550 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
500 | } | 1551 | } |
501 | 1552 | impl AstNode for RetType { | |
502 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1553 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } |
503 | pub struct TupleType { | 1554 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
504 | pub(crate) syntax: SyntaxNode, | 1555 | if Self::can_cast(syntax.kind()) { |
1556 | Some(Self { syntax }) | ||
1557 | } else { | ||
1558 | None | ||
1559 | } | ||
1560 | } | ||
1561 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
505 | } | 1562 | } |
506 | impl AstNode for TupleType { | 1563 | impl AstNode for StructDef { |
507 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } | 1564 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } |
508 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1565 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
509 | if Self::can_cast(syntax.kind()) { | 1566 | if Self::can_cast(syntax.kind()) { |
510 | Some(Self { syntax }) | 1567 | Some(Self { syntax }) |
@@ -514,18 +1571,30 @@ impl AstNode for TupleType { | |||
514 | } | 1571 | } |
515 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1572 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
516 | } | 1573 | } |
517 | impl TupleType { | 1574 | impl AstNode for UnionDef { |
518 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1575 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } |
519 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } | 1576 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
520 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1577 | if Self::can_cast(syntax.kind()) { |
1578 | Some(Self { syntax }) | ||
1579 | } else { | ||
1580 | None | ||
1581 | } | ||
1582 | } | ||
1583 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
521 | } | 1584 | } |
522 | 1585 | impl AstNode for RecordFieldDefList { | |
523 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1586 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } |
524 | pub struct NeverType { | 1587 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
525 | pub(crate) syntax: SyntaxNode, | 1588 | if Self::can_cast(syntax.kind()) { |
1589 | Some(Self { syntax }) | ||
1590 | } else { | ||
1591 | None | ||
1592 | } | ||
1593 | } | ||
1594 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
526 | } | 1595 | } |
527 | impl AstNode for NeverType { | 1596 | impl AstNode for RecordFieldDef { |
528 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } | 1597 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } |
529 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1598 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
530 | if Self::can_cast(syntax.kind()) { | 1599 | if Self::can_cast(syntax.kind()) { |
531 | Some(Self { syntax }) | 1600 | Some(Self { syntax }) |
@@ -535,16 +1604,30 @@ impl AstNode for NeverType { | |||
535 | } | 1604 | } |
536 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1605 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
537 | } | 1606 | } |
538 | impl NeverType { | 1607 | impl AstNode for TupleFieldDefList { |
539 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 1608 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } |
1609 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1610 | if Self::can_cast(syntax.kind()) { | ||
1611 | Some(Self { syntax }) | ||
1612 | } else { | ||
1613 | None | ||
1614 | } | ||
1615 | } | ||
1616 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
540 | } | 1617 | } |
541 | 1618 | impl AstNode for TupleFieldDef { | |
542 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1619 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } |
543 | pub struct PathType { | 1620 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
544 | pub(crate) syntax: SyntaxNode, | 1621 | if Self::can_cast(syntax.kind()) { |
1622 | Some(Self { syntax }) | ||
1623 | } else { | ||
1624 | None | ||
1625 | } | ||
1626 | } | ||
1627 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
545 | } | 1628 | } |
546 | impl AstNode for PathType { | 1629 | impl AstNode for EnumDef { |
547 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } | 1630 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } |
548 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1631 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
549 | if Self::can_cast(syntax.kind()) { | 1632 | if Self::can_cast(syntax.kind()) { |
550 | Some(Self { syntax }) | 1633 | Some(Self { syntax }) |
@@ -554,16 +1637,30 @@ impl AstNode for PathType { | |||
554 | } | 1637 | } |
555 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1638 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
556 | } | 1639 | } |
557 | impl PathType { | 1640 | impl AstNode for EnumVariantList { |
558 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1641 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } |
1642 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1643 | if Self::can_cast(syntax.kind()) { | ||
1644 | Some(Self { syntax }) | ||
1645 | } else { | ||
1646 | None | ||
1647 | } | ||
1648 | } | ||
1649 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
559 | } | 1650 | } |
560 | 1651 | impl AstNode for EnumVariant { | |
561 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1652 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } |
562 | pub struct PointerType { | 1653 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
563 | pub(crate) syntax: SyntaxNode, | 1654 | if Self::can_cast(syntax.kind()) { |
1655 | Some(Self { syntax }) | ||
1656 | } else { | ||
1657 | None | ||
1658 | } | ||
1659 | } | ||
1660 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
564 | } | 1661 | } |
565 | impl AstNode for PointerType { | 1662 | impl AstNode for TraitDef { |
566 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } | 1663 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } |
567 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1664 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
568 | if Self::can_cast(syntax.kind()) { | 1665 | if Self::can_cast(syntax.kind()) { |
569 | Some(Self { syntax }) | 1666 | Some(Self { syntax }) |
@@ -573,19 +1670,30 @@ impl AstNode for PointerType { | |||
573 | } | 1670 | } |
574 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1671 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
575 | } | 1672 | } |
576 | impl PointerType { | 1673 | impl AstNode for Module { |
577 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | 1674 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } |
578 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 1675 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
579 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 1676 | if Self::can_cast(syntax.kind()) { |
580 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1677 | Some(Self { syntax }) |
1678 | } else { | ||
1679 | None | ||
1680 | } | ||
1681 | } | ||
1682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
581 | } | 1683 | } |
582 | 1684 | impl AstNode for ItemList { | |
583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1685 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } |
584 | pub struct ArrayType { | 1686 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
585 | pub(crate) syntax: SyntaxNode, | 1687 | if Self::can_cast(syntax.kind()) { |
1688 | Some(Self { syntax }) | ||
1689 | } else { | ||
1690 | None | ||
1691 | } | ||
1692 | } | ||
1693 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
586 | } | 1694 | } |
587 | impl AstNode for ArrayType { | 1695 | impl AstNode for ConstDef { |
588 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } | 1696 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } |
589 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1697 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
590 | if Self::can_cast(syntax.kind()) { | 1698 | if Self::can_cast(syntax.kind()) { |
591 | Some(Self { syntax }) | 1699 | Some(Self { syntax }) |
@@ -595,20 +1703,30 @@ impl AstNode for ArrayType { | |||
595 | } | 1703 | } |
596 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1704 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
597 | } | 1705 | } |
598 | impl ArrayType { | 1706 | impl AstNode for StaticDef { |
599 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 1707 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } |
600 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1708 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
601 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 1709 | if Self::can_cast(syntax.kind()) { |
602 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1710 | Some(Self { syntax }) |
603 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 1711 | } else { |
1712 | None | ||
1713 | } | ||
1714 | } | ||
1715 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
604 | } | 1716 | } |
605 | 1717 | impl AstNode for TypeAliasDef { | |
606 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1718 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } |
607 | pub struct SliceType { | 1719 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
608 | pub(crate) syntax: SyntaxNode, | 1720 | if Self::can_cast(syntax.kind()) { |
1721 | Some(Self { syntax }) | ||
1722 | } else { | ||
1723 | None | ||
1724 | } | ||
1725 | } | ||
1726 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
609 | } | 1727 | } |
610 | impl AstNode for SliceType { | 1728 | impl AstNode for ImplDef { |
611 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } | 1729 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } |
612 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1730 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
613 | if Self::can_cast(syntax.kind()) { | 1731 | if Self::can_cast(syntax.kind()) { |
614 | Some(Self { syntax }) | 1732 | Some(Self { syntax }) |
@@ -618,18 +1736,30 @@ impl AstNode for SliceType { | |||
618 | } | 1736 | } |
619 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1737 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
620 | } | 1738 | } |
621 | impl SliceType { | 1739 | impl AstNode for ParenType { |
622 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 1740 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } |
623 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1741 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
624 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 1742 | if Self::can_cast(syntax.kind()) { |
1743 | Some(Self { syntax }) | ||
1744 | } else { | ||
1745 | None | ||
1746 | } | ||
1747 | } | ||
1748 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
625 | } | 1749 | } |
626 | 1750 | impl AstNode for TupleType { | |
627 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1751 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } |
628 | pub struct ReferenceType { | 1752 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
629 | pub(crate) syntax: SyntaxNode, | 1753 | if Self::can_cast(syntax.kind()) { |
1754 | Some(Self { syntax }) | ||
1755 | } else { | ||
1756 | None | ||
1757 | } | ||
1758 | } | ||
1759 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
630 | } | 1760 | } |
631 | impl AstNode for ReferenceType { | 1761 | impl AstNode for NeverType { |
632 | fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } | 1762 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } |
633 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1763 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
634 | if Self::can_cast(syntax.kind()) { | 1764 | if Self::can_cast(syntax.kind()) { |
635 | Some(Self { syntax }) | 1765 | Some(Self { syntax }) |
@@ -639,21 +1769,30 @@ impl AstNode for ReferenceType { | |||
639 | } | 1769 | } |
640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1770 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
641 | } | 1771 | } |
642 | impl ReferenceType { | 1772 | impl AstNode for PathType { |
643 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 1773 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } |
644 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 1774 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
645 | support::token(&self.syntax, T![lifetime]) | 1775 | if Self::can_cast(syntax.kind()) { |
1776 | Some(Self { syntax }) | ||
1777 | } else { | ||
1778 | None | ||
1779 | } | ||
646 | } | 1780 | } |
647 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 1781 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
648 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
649 | } | 1782 | } |
650 | 1783 | impl AstNode for PointerType { | |
651 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1784 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } |
652 | pub struct PlaceholderType { | 1785 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
653 | pub(crate) syntax: SyntaxNode, | 1786 | if Self::can_cast(syntax.kind()) { |
1787 | Some(Self { syntax }) | ||
1788 | } else { | ||
1789 | None | ||
1790 | } | ||
1791 | } | ||
1792 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
654 | } | 1793 | } |
655 | impl AstNode for PlaceholderType { | 1794 | impl AstNode for ArrayType { |
656 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } | 1795 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } |
657 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1796 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
658 | if Self::can_cast(syntax.kind()) { | 1797 | if Self::can_cast(syntax.kind()) { |
659 | Some(Self { syntax }) | 1798 | Some(Self { syntax }) |
@@ -663,13 +1802,38 @@ impl AstNode for PlaceholderType { | |||
663 | } | 1802 | } |
664 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1803 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
665 | } | 1804 | } |
666 | impl PlaceholderType { | 1805 | impl AstNode for SliceType { |
667 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1806 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } |
1807 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1808 | if Self::can_cast(syntax.kind()) { | ||
1809 | Some(Self { syntax }) | ||
1810 | } else { | ||
1811 | None | ||
1812 | } | ||
1813 | } | ||
1814 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
668 | } | 1815 | } |
669 | 1816 | impl AstNode for ReferenceType { | |
670 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1817 | fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } |
671 | pub struct FnPointerType { | 1818 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
672 | pub(crate) syntax: SyntaxNode, | 1819 | if Self::can_cast(syntax.kind()) { |
1820 | Some(Self { syntax }) | ||
1821 | } else { | ||
1822 | None | ||
1823 | } | ||
1824 | } | ||
1825 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1826 | } | ||
1827 | impl AstNode for PlaceholderType { | ||
1828 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } | ||
1829 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1830 | if Self::can_cast(syntax.kind()) { | ||
1831 | Some(Self { syntax }) | ||
1832 | } else { | ||
1833 | None | ||
1834 | } | ||
1835 | } | ||
1836 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
673 | } | 1837 | } |
674 | impl AstNode for FnPointerType { | 1838 | impl AstNode for FnPointerType { |
675 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } | 1839 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } |
@@ -682,18 +1846,6 @@ impl AstNode for FnPointerType { | |||
682 | } | 1846 | } |
683 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1847 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
684 | } | 1848 | } |
685 | impl FnPointerType { | ||
686 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
687 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
688 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
689 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
690 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
691 | } | ||
692 | |||
693 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
694 | pub struct ForType { | ||
695 | pub(crate) syntax: SyntaxNode, | ||
696 | } | ||
697 | impl AstNode for ForType { | 1849 | impl AstNode for ForType { |
698 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } | 1850 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } |
699 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1851 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -705,16 +1857,6 @@ impl AstNode for ForType { | |||
705 | } | 1857 | } |
706 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1858 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
707 | } | 1859 | } |
708 | impl ForType { | ||
709 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
710 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | ||
711 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
712 | } | ||
713 | |||
714 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
715 | pub struct ImplTraitType { | ||
716 | pub(crate) syntax: SyntaxNode, | ||
717 | } | ||
718 | impl AstNode for ImplTraitType { | 1860 | impl AstNode for ImplTraitType { |
719 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } | 1861 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } |
720 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1862 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -726,15 +1868,6 @@ impl AstNode for ImplTraitType { | |||
726 | } | 1868 | } |
727 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1869 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
728 | } | 1870 | } |
729 | impl ast::TypeBoundsOwner for ImplTraitType {} | ||
730 | impl ImplTraitType { | ||
731 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | ||
732 | } | ||
733 | |||
734 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
735 | pub struct DynTraitType { | ||
736 | pub(crate) syntax: SyntaxNode, | ||
737 | } | ||
738 | impl AstNode for DynTraitType { | 1871 | impl AstNode for DynTraitType { |
739 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } | 1872 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } |
740 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1873 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -746,15 +1879,6 @@ impl AstNode for DynTraitType { | |||
746 | } | 1879 | } |
747 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1880 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
748 | } | 1881 | } |
749 | impl ast::TypeBoundsOwner for DynTraitType {} | ||
750 | impl DynTraitType { | ||
751 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } | ||
752 | } | ||
753 | |||
754 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
755 | pub struct TupleExpr { | ||
756 | pub(crate) syntax: SyntaxNode, | ||
757 | } | ||
758 | impl AstNode for TupleExpr { | 1882 | impl AstNode for TupleExpr { |
759 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } | 1883 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } |
760 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1884 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -766,17 +1890,6 @@ impl AstNode for TupleExpr { | |||
766 | } | 1890 | } |
767 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1891 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
768 | } | 1892 | } |
769 | impl ast::AttrsOwner for TupleExpr {} | ||
770 | impl TupleExpr { | ||
771 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
772 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
773 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
774 | } | ||
775 | |||
776 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
777 | pub struct ArrayExpr { | ||
778 | pub(crate) syntax: SyntaxNode, | ||
779 | } | ||
780 | impl AstNode for ArrayExpr { | 1893 | impl AstNode for ArrayExpr { |
781 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } | 1894 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } |
782 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1895 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -788,18 +1901,6 @@ impl AstNode for ArrayExpr { | |||
788 | } | 1901 | } |
789 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1902 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
790 | } | 1903 | } |
791 | impl ast::AttrsOwner for ArrayExpr {} | ||
792 | impl ArrayExpr { | ||
793 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
794 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
795 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
796 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
797 | } | ||
798 | |||
799 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
800 | pub struct ParenExpr { | ||
801 | pub(crate) syntax: SyntaxNode, | ||
802 | } | ||
803 | impl AstNode for ParenExpr { | 1904 | impl AstNode for ParenExpr { |
804 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } | 1905 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } |
805 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1906 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -811,17 +1912,6 @@ impl AstNode for ParenExpr { | |||
811 | } | 1912 | } |
812 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1913 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
813 | } | 1914 | } |
814 | impl ast::AttrsOwner for ParenExpr {} | ||
815 | impl ParenExpr { | ||
816 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
817 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
818 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
819 | } | ||
820 | |||
821 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
822 | pub struct PathExpr { | ||
823 | pub(crate) syntax: SyntaxNode, | ||
824 | } | ||
825 | impl AstNode for PathExpr { | 1915 | impl AstNode for PathExpr { |
826 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } | 1916 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } |
827 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1917 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -833,14 +1923,6 @@ impl AstNode for PathExpr { | |||
833 | } | 1923 | } |
834 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1924 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
835 | } | 1925 | } |
836 | impl PathExpr { | ||
837 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
838 | } | ||
839 | |||
840 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
841 | pub struct LambdaExpr { | ||
842 | pub(crate) syntax: SyntaxNode, | ||
843 | } | ||
844 | impl AstNode for LambdaExpr { | 1926 | impl AstNode for LambdaExpr { |
845 | fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } | 1927 | fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } |
846 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1928 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -852,20 +1934,6 @@ impl AstNode for LambdaExpr { | |||
852 | } | 1934 | } |
853 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1935 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
854 | } | 1936 | } |
855 | impl ast::AttrsOwner for LambdaExpr {} | ||
856 | impl LambdaExpr { | ||
857 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
858 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
859 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | ||
860 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
861 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
862 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
863 | } | ||
864 | |||
865 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
866 | pub struct IfExpr { | ||
867 | pub(crate) syntax: SyntaxNode, | ||
868 | } | ||
869 | impl AstNode for IfExpr { | 1937 | impl AstNode for IfExpr { |
870 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } | 1938 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } |
871 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1939 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -877,16 +1945,6 @@ impl AstNode for IfExpr { | |||
877 | } | 1945 | } |
878 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1946 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
879 | } | 1947 | } |
880 | impl ast::AttrsOwner for IfExpr {} | ||
881 | impl IfExpr { | ||
882 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
883 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
884 | } | ||
885 | |||
886 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
887 | pub struct LoopExpr { | ||
888 | pub(crate) syntax: SyntaxNode, | ||
889 | } | ||
890 | impl AstNode for LoopExpr { | 1948 | impl AstNode for LoopExpr { |
891 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } | 1949 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } |
892 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1950 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -898,16 +1956,6 @@ impl AstNode for LoopExpr { | |||
898 | } | 1956 | } |
899 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1957 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
900 | } | 1958 | } |
901 | impl ast::AttrsOwner for LoopExpr {} | ||
902 | impl ast::LoopBodyOwner for LoopExpr {} | ||
903 | impl LoopExpr { | ||
904 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } | ||
905 | } | ||
906 | |||
907 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
908 | pub struct TryBlockExpr { | ||
909 | pub(crate) syntax: SyntaxNode, | ||
910 | } | ||
911 | impl AstNode for TryBlockExpr { | 1959 | impl AstNode for TryBlockExpr { |
912 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR } | 1960 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR } |
913 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1961 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -919,16 +1967,6 @@ impl AstNode for TryBlockExpr { | |||
919 | } | 1967 | } |
920 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1968 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
921 | } | 1969 | } |
922 | impl ast::AttrsOwner for TryBlockExpr {} | ||
923 | impl TryBlockExpr { | ||
924 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
925 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
926 | } | ||
927 | |||
928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
929 | pub struct ForExpr { | ||
930 | pub(crate) syntax: SyntaxNode, | ||
931 | } | ||
932 | impl AstNode for ForExpr { | 1970 | impl AstNode for ForExpr { |
933 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } | 1971 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } |
934 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1972 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -940,19 +1978,6 @@ impl AstNode for ForExpr { | |||
940 | } | 1978 | } |
941 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1979 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
942 | } | 1980 | } |
943 | impl ast::AttrsOwner for ForExpr {} | ||
944 | impl ast::LoopBodyOwner for ForExpr {} | ||
945 | impl ForExpr { | ||
946 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
947 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
948 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } | ||
949 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
950 | } | ||
951 | |||
952 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
953 | pub struct WhileExpr { | ||
954 | pub(crate) syntax: SyntaxNode, | ||
955 | } | ||
956 | impl AstNode for WhileExpr { | 1981 | impl AstNode for WhileExpr { |
957 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } | 1982 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } |
958 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1983 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -964,17 +1989,6 @@ impl AstNode for WhileExpr { | |||
964 | } | 1989 | } |
965 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1990 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
966 | } | 1991 | } |
967 | impl ast::AttrsOwner for WhileExpr {} | ||
968 | impl ast::LoopBodyOwner for WhileExpr {} | ||
969 | impl WhileExpr { | ||
970 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } | ||
971 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
972 | } | ||
973 | |||
974 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
975 | pub struct ContinueExpr { | ||
976 | pub(crate) syntax: SyntaxNode, | ||
977 | } | ||
978 | impl AstNode for ContinueExpr { | 1992 | impl AstNode for ContinueExpr { |
979 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } | 1993 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } |
980 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1994 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -986,20 +2000,6 @@ impl AstNode for ContinueExpr { | |||
986 | } | 2000 | } |
987 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2001 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
988 | } | 2002 | } |
989 | impl ast::AttrsOwner for ContinueExpr {} | ||
990 | impl ContinueExpr { | ||
991 | pub fn continue_token(&self) -> Option<SyntaxToken> { | ||
992 | support::token(&self.syntax, T![continue]) | ||
993 | } | ||
994 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
995 | support::token(&self.syntax, T![lifetime]) | ||
996 | } | ||
997 | } | ||
998 | |||
999 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1000 | pub struct BreakExpr { | ||
1001 | pub(crate) syntax: SyntaxNode, | ||
1002 | } | ||
1003 | impl AstNode for BreakExpr { | 2003 | impl AstNode for BreakExpr { |
1004 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } | 2004 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } |
1005 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2005 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1011,19 +2011,6 @@ impl AstNode for BreakExpr { | |||
1011 | } | 2011 | } |
1012 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2012 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1013 | } | 2013 | } |
1014 | impl ast::AttrsOwner for BreakExpr {} | ||
1015 | impl BreakExpr { | ||
1016 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } | ||
1017 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1018 | support::token(&self.syntax, T![lifetime]) | ||
1019 | } | ||
1020 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1021 | } | ||
1022 | |||
1023 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1024 | pub struct Label { | ||
1025 | pub(crate) syntax: SyntaxNode, | ||
1026 | } | ||
1027 | impl AstNode for Label { | 2014 | impl AstNode for Label { |
1028 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } | 2015 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } |
1029 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2016 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1035,16 +2022,6 @@ impl AstNode for Label { | |||
1035 | } | 2022 | } |
1036 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2023 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1037 | } | 2024 | } |
1038 | impl Label { | ||
1039 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1040 | support::token(&self.syntax, T![lifetime]) | ||
1041 | } | ||
1042 | } | ||
1043 | |||
1044 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1045 | pub struct BlockExpr { | ||
1046 | pub(crate) syntax: SyntaxNode, | ||
1047 | } | ||
1048 | impl AstNode for BlockExpr { | 2025 | impl AstNode for BlockExpr { |
1049 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } | 2026 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } |
1050 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2027 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1056,17 +2033,6 @@ impl AstNode for BlockExpr { | |||
1056 | } | 2033 | } |
1057 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2034 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1058 | } | 2035 | } |
1059 | impl ast::AttrsOwner for BlockExpr {} | ||
1060 | impl BlockExpr { | ||
1061 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
1062 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
1063 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | ||
1064 | } | ||
1065 | |||
1066 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1067 | pub struct ReturnExpr { | ||
1068 | pub(crate) syntax: SyntaxNode, | ||
1069 | } | ||
1070 | impl AstNode for ReturnExpr { | 2036 | impl AstNode for ReturnExpr { |
1071 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } | 2037 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } |
1072 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2038 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1078,15 +2044,6 @@ impl AstNode for ReturnExpr { | |||
1078 | } | 2044 | } |
1079 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2045 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1080 | } | 2046 | } |
1081 | impl ast::AttrsOwner for ReturnExpr {} | ||
1082 | impl ReturnExpr { | ||
1083 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1084 | } | ||
1085 | |||
1086 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1087 | pub struct CallExpr { | ||
1088 | pub(crate) syntax: SyntaxNode, | ||
1089 | } | ||
1090 | impl AstNode for CallExpr { | 2047 | impl AstNode for CallExpr { |
1091 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } | 2048 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } |
1092 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2049 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1098,15 +2055,6 @@ impl AstNode for CallExpr { | |||
1098 | } | 2055 | } |
1099 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2056 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1100 | } | 2057 | } |
1101 | impl ast::ArgListOwner for CallExpr {} | ||
1102 | impl CallExpr { | ||
1103 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1104 | } | ||
1105 | |||
1106 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1107 | pub struct MethodCallExpr { | ||
1108 | pub(crate) syntax: SyntaxNode, | ||
1109 | } | ||
1110 | impl AstNode for MethodCallExpr { | 2058 | impl AstNode for MethodCallExpr { |
1111 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } | 2059 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } |
1112 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2060 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1118,19 +2066,6 @@ impl AstNode for MethodCallExpr { | |||
1118 | } | 2066 | } |
1119 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2067 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1120 | } | 2068 | } |
1121 | impl ast::AttrsOwner for MethodCallExpr {} | ||
1122 | impl ast::ArgListOwner for MethodCallExpr {} | ||
1123 | impl MethodCallExpr { | ||
1124 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1125 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
1126 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1127 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
1128 | } | ||
1129 | |||
1130 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1131 | pub struct IndexExpr { | ||
1132 | pub(crate) syntax: SyntaxNode, | ||
1133 | } | ||
1134 | impl AstNode for IndexExpr { | 2069 | impl AstNode for IndexExpr { |
1135 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } | 2070 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } |
1136 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2071 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1142,16 +2077,6 @@ impl AstNode for IndexExpr { | |||
1142 | } | 2077 | } |
1143 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2078 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1144 | } | 2079 | } |
1145 | impl ast::AttrsOwner for IndexExpr {} | ||
1146 | impl IndexExpr { | ||
1147 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
1148 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
1149 | } | ||
1150 | |||
1151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1152 | pub struct FieldExpr { | ||
1153 | pub(crate) syntax: SyntaxNode, | ||
1154 | } | ||
1155 | impl AstNode for FieldExpr { | 2080 | impl AstNode for FieldExpr { |
1156 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } | 2081 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } |
1157 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2082 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1163,17 +2088,6 @@ impl AstNode for FieldExpr { | |||
1163 | } | 2088 | } |
1164 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2089 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1165 | } | 2090 | } |
1166 | impl ast::AttrsOwner for FieldExpr {} | ||
1167 | impl FieldExpr { | ||
1168 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1169 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
1170 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1171 | } | ||
1172 | |||
1173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1174 | pub struct AwaitExpr { | ||
1175 | pub(crate) syntax: SyntaxNode, | ||
1176 | } | ||
1177 | impl AstNode for AwaitExpr { | 2091 | impl AstNode for AwaitExpr { |
1178 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } | 2092 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } |
1179 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2093 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1185,17 +2099,6 @@ impl AstNode for AwaitExpr { | |||
1185 | } | 2099 | } |
1186 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2100 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1187 | } | 2101 | } |
1188 | impl ast::AttrsOwner for AwaitExpr {} | ||
1189 | impl AwaitExpr { | ||
1190 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1191 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
1192 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
1193 | } | ||
1194 | |||
1195 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1196 | pub struct TryExpr { | ||
1197 | pub(crate) syntax: SyntaxNode, | ||
1198 | } | ||
1199 | impl AstNode for TryExpr { | 2102 | impl AstNode for TryExpr { |
1200 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } | 2103 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } |
1201 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2104 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1207,16 +2110,6 @@ impl AstNode for TryExpr { | |||
1207 | } | 2110 | } |
1208 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2111 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1209 | } | 2112 | } |
1210 | impl ast::AttrsOwner for TryExpr {} | ||
1211 | impl TryExpr { | ||
1212 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
1213 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1214 | } | ||
1215 | |||
1216 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1217 | pub struct CastExpr { | ||
1218 | pub(crate) syntax: SyntaxNode, | ||
1219 | } | ||
1220 | impl AstNode for CastExpr { | 2113 | impl AstNode for CastExpr { |
1221 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } | 2114 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } |
1222 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2115 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1228,17 +2121,6 @@ impl AstNode for CastExpr { | |||
1228 | } | 2121 | } |
1229 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2122 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1230 | } | 2123 | } |
1231 | impl ast::AttrsOwner for CastExpr {} | ||
1232 | impl CastExpr { | ||
1233 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1234 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
1235 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1236 | } | ||
1237 | |||
1238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1239 | pub struct RefExpr { | ||
1240 | pub(crate) syntax: SyntaxNode, | ||
1241 | } | ||
1242 | impl AstNode for RefExpr { | 2124 | impl AstNode for RefExpr { |
1243 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } | 2125 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } |
1244 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2126 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1250,18 +2132,6 @@ impl AstNode for RefExpr { | |||
1250 | } | 2132 | } |
1251 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2133 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1252 | } | 2134 | } |
1253 | impl ast::AttrsOwner for RefExpr {} | ||
1254 | impl RefExpr { | ||
1255 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
1256 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } | ||
1257 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1258 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1259 | } | ||
1260 | |||
1261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1262 | pub struct PrefixExpr { | ||
1263 | pub(crate) syntax: SyntaxNode, | ||
1264 | } | ||
1265 | impl AstNode for PrefixExpr { | 2135 | impl AstNode for PrefixExpr { |
1266 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } | 2136 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } |
1267 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2137 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1273,15 +2143,6 @@ impl AstNode for PrefixExpr { | |||
1273 | } | 2143 | } |
1274 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2144 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1275 | } | 2145 | } |
1276 | impl ast::AttrsOwner for PrefixExpr {} | ||
1277 | impl PrefixExpr { | ||
1278 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1279 | } | ||
1280 | |||
1281 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1282 | pub struct BoxExpr { | ||
1283 | pub(crate) syntax: SyntaxNode, | ||
1284 | } | ||
1285 | impl AstNode for BoxExpr { | 2146 | impl AstNode for BoxExpr { |
1286 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } | 2147 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } |
1287 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2148 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1293,16 +2154,6 @@ impl AstNode for BoxExpr { | |||
1293 | } | 2154 | } |
1294 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2155 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1295 | } | 2156 | } |
1296 | impl ast::AttrsOwner for BoxExpr {} | ||
1297 | impl BoxExpr { | ||
1298 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | ||
1299 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1300 | } | ||
1301 | |||
1302 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1303 | pub struct RangeExpr { | ||
1304 | pub(crate) syntax: SyntaxNode, | ||
1305 | } | ||
1306 | impl AstNode for RangeExpr { | 2157 | impl AstNode for RangeExpr { |
1307 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } | 2158 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } |
1308 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2159 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1314,13 +2165,6 @@ impl AstNode for RangeExpr { | |||
1314 | } | 2165 | } |
1315 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2166 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1316 | } | 2167 | } |
1317 | impl ast::AttrsOwner for RangeExpr {} | ||
1318 | impl RangeExpr {} | ||
1319 | |||
1320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1321 | pub struct BinExpr { | ||
1322 | pub(crate) syntax: SyntaxNode, | ||
1323 | } | ||
1324 | impl AstNode for BinExpr { | 2168 | impl AstNode for BinExpr { |
1325 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } | 2169 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } |
1326 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2170 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1332,13 +2176,6 @@ impl AstNode for BinExpr { | |||
1332 | } | 2176 | } |
1333 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2177 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1334 | } | 2178 | } |
1335 | impl ast::AttrsOwner for BinExpr {} | ||
1336 | impl BinExpr {} | ||
1337 | |||
1338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1339 | pub struct Literal { | ||
1340 | pub(crate) syntax: SyntaxNode, | ||
1341 | } | ||
1342 | impl AstNode for Literal { | 2179 | impl AstNode for Literal { |
1343 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } | 2180 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } |
1344 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2181 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1350,12 +2187,6 @@ impl AstNode for Literal { | |||
1350 | } | 2187 | } |
1351 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2188 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1352 | } | 2189 | } |
1353 | impl Literal {} | ||
1354 | |||
1355 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1356 | pub struct MatchExpr { | ||
1357 | pub(crate) syntax: SyntaxNode, | ||
1358 | } | ||
1359 | impl AstNode for MatchExpr { | 2190 | impl AstNode for MatchExpr { |
1360 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } | 2191 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } |
1361 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2192 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1367,17 +2198,6 @@ impl AstNode for MatchExpr { | |||
1367 | } | 2198 | } |
1368 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2199 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1369 | } | 2200 | } |
1370 | impl ast::AttrsOwner for MatchExpr {} | ||
1371 | impl MatchExpr { | ||
1372 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } | ||
1373 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1374 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | ||
1375 | } | ||
1376 | |||
1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1378 | pub struct MatchArmList { | ||
1379 | pub(crate) syntax: SyntaxNode, | ||
1380 | } | ||
1381 | impl AstNode for MatchArmList { | 2201 | impl AstNode for MatchArmList { |
1382 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } | 2202 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } |
1383 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2203 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1389,17 +2209,6 @@ impl AstNode for MatchArmList { | |||
1389 | } | 2209 | } |
1390 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2210 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1391 | } | 2211 | } |
1392 | impl ast::AttrsOwner for MatchArmList {} | ||
1393 | impl MatchArmList { | ||
1394 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1395 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | ||
1396 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1397 | } | ||
1398 | |||
1399 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1400 | pub struct MatchArm { | ||
1401 | pub(crate) syntax: SyntaxNode, | ||
1402 | } | ||
1403 | impl AstNode for MatchArm { | 2212 | impl AstNode for MatchArm { |
1404 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } | 2213 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } |
1405 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2214 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1411,18 +2220,6 @@ impl AstNode for MatchArm { | |||
1411 | } | 2220 | } |
1412 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2221 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1413 | } | 2222 | } |
1414 | impl ast::AttrsOwner for MatchArm {} | ||
1415 | impl MatchArm { | ||
1416 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1417 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | ||
1418 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } | ||
1419 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1420 | } | ||
1421 | |||
1422 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1423 | pub struct MatchGuard { | ||
1424 | pub(crate) syntax: SyntaxNode, | ||
1425 | } | ||
1426 | impl AstNode for MatchGuard { | 2223 | impl AstNode for MatchGuard { |
1427 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } | 2224 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } |
1428 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2225 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1434,15 +2231,6 @@ impl AstNode for MatchGuard { | |||
1434 | } | 2231 | } |
1435 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2232 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1436 | } | 2233 | } |
1437 | impl MatchGuard { | ||
1438 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
1439 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1440 | } | ||
1441 | |||
1442 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1443 | pub struct RecordLit { | ||
1444 | pub(crate) syntax: SyntaxNode, | ||
1445 | } | ||
1446 | impl AstNode for RecordLit { | 2234 | impl AstNode for RecordLit { |
1447 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT } | 2235 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT } |
1448 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2236 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1454,15 +2242,6 @@ impl AstNode for RecordLit { | |||
1454 | } | 2242 | } |
1455 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2243 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1456 | } | 2244 | } |
1457 | impl RecordLit { | ||
1458 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1459 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | ||
1460 | } | ||
1461 | |||
1462 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1463 | pub struct RecordFieldList { | ||
1464 | pub(crate) syntax: SyntaxNode, | ||
1465 | } | ||
1466 | impl AstNode for RecordFieldList { | 2245 | impl AstNode for RecordFieldList { |
1467 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } | 2246 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } |
1468 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2247 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1474,18 +2253,6 @@ impl AstNode for RecordFieldList { | |||
1474 | } | 2253 | } |
1475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2254 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1476 | } | 2255 | } |
1477 | impl RecordFieldList { | ||
1478 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1479 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } | ||
1480 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
1481 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1482 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1483 | } | ||
1484 | |||
1485 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1486 | pub struct RecordField { | ||
1487 | pub(crate) syntax: SyntaxNode, | ||
1488 | } | ||
1489 | impl AstNode for RecordField { | 2256 | impl AstNode for RecordField { |
1490 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } | 2257 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } |
1491 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2258 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1497,17 +2264,6 @@ impl AstNode for RecordField { | |||
1497 | } | 2264 | } |
1498 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2265 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1499 | } | 2266 | } |
1500 | impl ast::AttrsOwner for RecordField {} | ||
1501 | impl RecordField { | ||
1502 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1503 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1504 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1505 | } | ||
1506 | |||
1507 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1508 | pub struct OrPat { | ||
1509 | pub(crate) syntax: SyntaxNode, | ||
1510 | } | ||
1511 | impl AstNode for OrPat { | 2267 | impl AstNode for OrPat { |
1512 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } | 2268 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } |
1513 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2269 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1519,14 +2275,6 @@ impl AstNode for OrPat { | |||
1519 | } | 2275 | } |
1520 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2276 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1521 | } | 2277 | } |
1522 | impl OrPat { | ||
1523 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1524 | } | ||
1525 | |||
1526 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1527 | pub struct ParenPat { | ||
1528 | pub(crate) syntax: SyntaxNode, | ||
1529 | } | ||
1530 | impl AstNode for ParenPat { | 2278 | impl AstNode for ParenPat { |
1531 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } | 2279 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } |
1532 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2280 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1538,16 +2286,6 @@ impl AstNode for ParenPat { | |||
1538 | } | 2286 | } |
1539 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2287 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1540 | } | 2288 | } |
1541 | impl ParenPat { | ||
1542 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1543 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1544 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1545 | } | ||
1546 | |||
1547 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1548 | pub struct RefPat { | ||
1549 | pub(crate) syntax: SyntaxNode, | ||
1550 | } | ||
1551 | impl AstNode for RefPat { | 2289 | impl AstNode for RefPat { |
1552 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } | 2290 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } |
1553 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2291 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1559,16 +2297,6 @@ impl AstNode for RefPat { | |||
1559 | } | 2297 | } |
1560 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2298 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1561 | } | 2299 | } |
1562 | impl RefPat { | ||
1563 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
1564 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1565 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1566 | } | ||
1567 | |||
1568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1569 | pub struct BoxPat { | ||
1570 | pub(crate) syntax: SyntaxNode, | ||
1571 | } | ||
1572 | impl AstNode for BoxPat { | 2300 | impl AstNode for BoxPat { |
1573 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } | 2301 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } |
1574 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2302 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1580,15 +2308,6 @@ impl AstNode for BoxPat { | |||
1580 | } | 2308 | } |
1581 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2309 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1582 | } | 2310 | } |
1583 | impl BoxPat { | ||
1584 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | ||
1585 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1586 | } | ||
1587 | |||
1588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1589 | pub struct BindPat { | ||
1590 | pub(crate) syntax: SyntaxNode, | ||
1591 | } | ||
1592 | impl AstNode for BindPat { | 2311 | impl AstNode for BindPat { |
1593 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } | 2312 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } |
1594 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2313 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1600,19 +2319,6 @@ impl AstNode for BindPat { | |||
1600 | } | 2319 | } |
1601 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2320 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1602 | } | 2321 | } |
1603 | impl ast::AttrsOwner for BindPat {} | ||
1604 | impl ast::NameOwner for BindPat {} | ||
1605 | impl BindPat { | ||
1606 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
1607 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1608 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1609 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1610 | } | ||
1611 | |||
1612 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1613 | pub struct PlaceholderPat { | ||
1614 | pub(crate) syntax: SyntaxNode, | ||
1615 | } | ||
1616 | impl AstNode for PlaceholderPat { | 2322 | impl AstNode for PlaceholderPat { |
1617 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } | 2323 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } |
1618 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2324 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1624,14 +2330,6 @@ impl AstNode for PlaceholderPat { | |||
1624 | } | 2330 | } |
1625 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2331 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1626 | } | 2332 | } |
1627 | impl PlaceholderPat { | ||
1628 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
1629 | } | ||
1630 | |||
1631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1632 | pub struct DotDotPat { | ||
1633 | pub(crate) syntax: SyntaxNode, | ||
1634 | } | ||
1635 | impl AstNode for DotDotPat { | 2333 | impl AstNode for DotDotPat { |
1636 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } | 2334 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } |
1637 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2335 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1643,14 +2341,6 @@ impl AstNode for DotDotPat { | |||
1643 | } | 2341 | } |
1644 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2342 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1645 | } | 2343 | } |
1646 | impl DotDotPat { | ||
1647 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
1648 | } | ||
1649 | |||
1650 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1651 | pub struct PathPat { | ||
1652 | pub(crate) syntax: SyntaxNode, | ||
1653 | } | ||
1654 | impl AstNode for PathPat { | 2344 | impl AstNode for PathPat { |
1655 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } | 2345 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } |
1656 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2346 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1662,14 +2352,6 @@ impl AstNode for PathPat { | |||
1662 | } | 2352 | } |
1663 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2353 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1664 | } | 2354 | } |
1665 | impl PathPat { | ||
1666 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1667 | } | ||
1668 | |||
1669 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1670 | pub struct SlicePat { | ||
1671 | pub(crate) syntax: SyntaxNode, | ||
1672 | } | ||
1673 | impl AstNode for SlicePat { | 2355 | impl AstNode for SlicePat { |
1674 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } | 2356 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } |
1675 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2357 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1681,16 +2363,6 @@ impl AstNode for SlicePat { | |||
1681 | } | 2363 | } |
1682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2364 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1683 | } | 2365 | } |
1684 | impl SlicePat { | ||
1685 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
1686 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1687 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
1688 | } | ||
1689 | |||
1690 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1691 | pub struct RangePat { | ||
1692 | pub(crate) syntax: SyntaxNode, | ||
1693 | } | ||
1694 | impl AstNode for RangePat { | 2366 | impl AstNode for RangePat { |
1695 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } | 2367 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } |
1696 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2368 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1702,12 +2374,6 @@ impl AstNode for RangePat { | |||
1702 | } | 2374 | } |
1703 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2375 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1704 | } | 2376 | } |
1705 | impl RangePat {} | ||
1706 | |||
1707 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1708 | pub struct LiteralPat { | ||
1709 | pub(crate) syntax: SyntaxNode, | ||
1710 | } | ||
1711 | impl AstNode for LiteralPat { | 2377 | impl AstNode for LiteralPat { |
1712 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } | 2378 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } |
1713 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2379 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1719,14 +2385,6 @@ impl AstNode for LiteralPat { | |||
1719 | } | 2385 | } |
1720 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2386 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1721 | } | 2387 | } |
1722 | impl LiteralPat { | ||
1723 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | ||
1724 | } | ||
1725 | |||
1726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1727 | pub struct MacroPat { | ||
1728 | pub(crate) syntax: SyntaxNode, | ||
1729 | } | ||
1730 | impl AstNode for MacroPat { | 2388 | impl AstNode for MacroPat { |
1731 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } | 2389 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } |
1732 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2390 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1738,14 +2396,6 @@ impl AstNode for MacroPat { | |||
1738 | } | 2396 | } |
1739 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2397 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1740 | } | 2398 | } |
1741 | impl MacroPat { | ||
1742 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | ||
1743 | } | ||
1744 | |||
1745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1746 | pub struct RecordPat { | ||
1747 | pub(crate) syntax: SyntaxNode, | ||
1748 | } | ||
1749 | impl AstNode for RecordPat { | 2399 | impl AstNode for RecordPat { |
1750 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } | 2400 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } |
1751 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2401 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1757,17 +2407,6 @@ impl AstNode for RecordPat { | |||
1757 | } | 2407 | } |
1758 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2408 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1759 | } | 2409 | } |
1760 | impl RecordPat { | ||
1761 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { | ||
1762 | support::child(&self.syntax) | ||
1763 | } | ||
1764 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1765 | } | ||
1766 | |||
1767 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1768 | pub struct RecordFieldPatList { | ||
1769 | pub(crate) syntax: SyntaxNode, | ||
1770 | } | ||
1771 | impl AstNode for RecordFieldPatList { | 2410 | impl AstNode for RecordFieldPatList { |
1772 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } | 2411 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } |
1773 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2412 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1779,21 +2418,6 @@ impl AstNode for RecordFieldPatList { | |||
1779 | } | 2418 | } |
1780 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2419 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1781 | } | 2420 | } |
1782 | impl RecordFieldPatList { | ||
1783 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1784 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } | ||
1785 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | ||
1786 | support::children(&self.syntax) | ||
1787 | } | ||
1788 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | ||
1789 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
1790 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1791 | } | ||
1792 | |||
1793 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1794 | pub struct RecordFieldPat { | ||
1795 | pub(crate) syntax: SyntaxNode, | ||
1796 | } | ||
1797 | impl AstNode for RecordFieldPat { | 2421 | impl AstNode for RecordFieldPat { |
1798 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } | 2422 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } |
1799 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2423 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1805,17 +2429,6 @@ impl AstNode for RecordFieldPat { | |||
1805 | } | 2429 | } |
1806 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2430 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1807 | } | 2431 | } |
1808 | impl ast::AttrsOwner for RecordFieldPat {} | ||
1809 | impl RecordFieldPat { | ||
1810 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1811 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1812 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1813 | } | ||
1814 | |||
1815 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1816 | pub struct TupleStructPat { | ||
1817 | pub(crate) syntax: SyntaxNode, | ||
1818 | } | ||
1819 | impl AstNode for TupleStructPat { | 2432 | impl AstNode for TupleStructPat { |
1820 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } | 2433 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } |
1821 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2434 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1827,17 +2440,6 @@ impl AstNode for TupleStructPat { | |||
1827 | } | 2440 | } |
1828 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2441 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1829 | } | 2442 | } |
1830 | impl TupleStructPat { | ||
1831 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1832 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1833 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1834 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1835 | } | ||
1836 | |||
1837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1838 | pub struct TuplePat { | ||
1839 | pub(crate) syntax: SyntaxNode, | ||
1840 | } | ||
1841 | impl AstNode for TuplePat { | 2443 | impl AstNode for TuplePat { |
1842 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } | 2444 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } |
1843 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2445 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1849,16 +2451,6 @@ impl AstNode for TuplePat { | |||
1849 | } | 2451 | } |
1850 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2452 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1851 | } | 2453 | } |
1852 | impl TuplePat { | ||
1853 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1854 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1855 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1856 | } | ||
1857 | |||
1858 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1859 | pub struct Visibility { | ||
1860 | pub(crate) syntax: SyntaxNode, | ||
1861 | } | ||
1862 | impl AstNode for Visibility { | 2454 | impl AstNode for Visibility { |
1863 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } | 2455 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } |
1864 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2456 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1870,17 +2462,6 @@ impl AstNode for Visibility { | |||
1870 | } | 2462 | } |
1871 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2463 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1872 | } | 2464 | } |
1873 | impl Visibility { | ||
1874 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } | ||
1875 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
1876 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1877 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
1878 | } | ||
1879 | |||
1880 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1881 | pub struct Name { | ||
1882 | pub(crate) syntax: SyntaxNode, | ||
1883 | } | ||
1884 | impl AstNode for Name { | 2465 | impl AstNode for Name { |
1885 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } | 2466 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } |
1886 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2467 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1892,14 +2473,6 @@ impl AstNode for Name { | |||
1892 | } | 2473 | } |
1893 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2474 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1894 | } | 2475 | } |
1895 | impl Name { | ||
1896 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
1897 | } | ||
1898 | |||
1899 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1900 | pub struct NameRef { | ||
1901 | pub(crate) syntax: SyntaxNode, | ||
1902 | } | ||
1903 | impl AstNode for NameRef { | 2476 | impl AstNode for NameRef { |
1904 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } | 2477 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } |
1905 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2478 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1911,12 +2484,6 @@ impl AstNode for NameRef { | |||
1911 | } | 2484 | } |
1912 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2485 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1913 | } | 2486 | } |
1914 | impl NameRef {} | ||
1915 | |||
1916 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1917 | pub struct MacroCall { | ||
1918 | pub(crate) syntax: SyntaxNode, | ||
1919 | } | ||
1920 | impl AstNode for MacroCall { | 2487 | impl AstNode for MacroCall { |
1921 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } | 2488 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } |
1922 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2489 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1928,20 +2495,6 @@ impl AstNode for MacroCall { | |||
1928 | } | 2495 | } |
1929 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2496 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1930 | } | 2497 | } |
1931 | impl ast::NameOwner for MacroCall {} | ||
1932 | impl ast::AttrsOwner for MacroCall {} | ||
1933 | impl ast::DocCommentsOwner for MacroCall {} | ||
1934 | impl MacroCall { | ||
1935 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1936 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
1937 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
1938 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1939 | } | ||
1940 | |||
1941 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1942 | pub struct Attr { | ||
1943 | pub(crate) syntax: SyntaxNode, | ||
1944 | } | ||
1945 | impl AstNode for Attr { | 2498 | impl AstNode for Attr { |
1946 | fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } | 2499 | fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } |
1947 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2500 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1953,20 +2506,6 @@ impl AstNode for Attr { | |||
1953 | } | 2506 | } |
1954 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2507 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1955 | } | 2508 | } |
1956 | impl Attr { | ||
1957 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } | ||
1958 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
1959 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
1960 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1961 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1962 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | ||
1963 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
1964 | } | ||
1965 | |||
1966 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1967 | pub struct TokenTree { | ||
1968 | pub(crate) syntax: SyntaxNode, | ||
1969 | } | ||
1970 | impl AstNode for TokenTree { | 2509 | impl AstNode for TokenTree { |
1971 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | 2510 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } |
1972 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2511 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1978,12 +2517,6 @@ impl AstNode for TokenTree { | |||
1978 | } | 2517 | } |
1979 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2518 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1980 | } | 2519 | } |
1981 | impl TokenTree {} | ||
1982 | |||
1983 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1984 | pub struct TypeParamList { | ||
1985 | pub(crate) syntax: SyntaxNode, | ||
1986 | } | ||
1987 | impl AstNode for TypeParamList { | 2520 | impl AstNode for TypeParamList { |
1988 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } | 2521 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } |
1989 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2522 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1995,19 +2528,6 @@ impl AstNode for TypeParamList { | |||
1995 | } | 2528 | } |
1996 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2529 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1997 | } | 2530 | } |
1998 | impl TypeParamList { | ||
1999 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
2000 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } | ||
2001 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | ||
2002 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | ||
2003 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | ||
2004 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
2005 | } | ||
2006 | |||
2007 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2008 | pub struct TypeParam { | ||
2009 | pub(crate) syntax: SyntaxNode, | ||
2010 | } | ||
2011 | impl AstNode for TypeParam { | 2531 | impl AstNode for TypeParam { |
2012 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } | 2532 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } |
2013 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2533 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2019,18 +2539,6 @@ impl AstNode for TypeParam { | |||
2019 | } | 2539 | } |
2020 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2540 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2021 | } | 2541 | } |
2022 | impl ast::NameOwner for TypeParam {} | ||
2023 | impl ast::AttrsOwner for TypeParam {} | ||
2024 | impl ast::TypeBoundsOwner for TypeParam {} | ||
2025 | impl TypeParam { | ||
2026 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2027 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
2028 | } | ||
2029 | |||
2030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2031 | pub struct ConstParam { | ||
2032 | pub(crate) syntax: SyntaxNode, | ||
2033 | } | ||
2034 | impl AstNode for ConstParam { | 2542 | impl AstNode for ConstParam { |
2035 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } | 2543 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } |
2036 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2544 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2042,18 +2550,6 @@ impl AstNode for ConstParam { | |||
2042 | } | 2550 | } |
2043 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2044 | } | 2552 | } |
2045 | impl ast::NameOwner for ConstParam {} | ||
2046 | impl ast::AttrsOwner for ConstParam {} | ||
2047 | impl ast::TypeAscriptionOwner for ConstParam {} | ||
2048 | impl ConstParam { | ||
2049 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2050 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2051 | } | ||
2052 | |||
2053 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2054 | pub struct LifetimeParam { | ||
2055 | pub(crate) syntax: SyntaxNode, | ||
2056 | } | ||
2057 | impl AstNode for LifetimeParam { | 2553 | impl AstNode for LifetimeParam { |
2058 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } | 2554 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } |
2059 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2555 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2065,17 +2561,6 @@ impl AstNode for LifetimeParam { | |||
2065 | } | 2561 | } |
2066 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2562 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2067 | } | 2563 | } |
2068 | impl ast::AttrsOwner for LifetimeParam {} | ||
2069 | impl LifetimeParam { | ||
2070 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
2071 | support::token(&self.syntax, T![lifetime]) | ||
2072 | } | ||
2073 | } | ||
2074 | |||
2075 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2076 | pub struct TypeBound { | ||
2077 | pub(crate) syntax: SyntaxNode, | ||
2078 | } | ||
2079 | impl AstNode for TypeBound { | 2564 | impl AstNode for TypeBound { |
2080 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } | 2565 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } |
2081 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2566 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2087,18 +2572,6 @@ impl AstNode for TypeBound { | |||
2087 | } | 2572 | } |
2088 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2573 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2089 | } | 2574 | } |
2090 | impl TypeBound { | ||
2091 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
2092 | support::token(&self.syntax, T![lifetime]) | ||
2093 | } | ||
2094 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
2095 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
2096 | } | ||
2097 | |||
2098 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2099 | pub struct TypeBoundList { | ||
2100 | pub(crate) syntax: SyntaxNode, | ||
2101 | } | ||
2102 | impl AstNode for TypeBoundList { | 2575 | impl AstNode for TypeBoundList { |
2103 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } | 2576 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } |
2104 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2577 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2110,14 +2583,6 @@ impl AstNode for TypeBoundList { | |||
2110 | } | 2583 | } |
2111 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2584 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2112 | } | 2585 | } |
2113 | impl TypeBoundList { | ||
2114 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | ||
2115 | } | ||
2116 | |||
2117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2118 | pub struct WherePred { | ||
2119 | pub(crate) syntax: SyntaxNode, | ||
2120 | } | ||
2121 | impl AstNode for WherePred { | 2586 | impl AstNode for WherePred { |
2122 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } | 2587 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } |
2123 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2588 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2129,18 +2594,6 @@ impl AstNode for WherePred { | |||
2129 | } | 2594 | } |
2130 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2131 | } | 2596 | } |
2132 | impl ast::TypeBoundsOwner for WherePred {} | ||
2133 | impl WherePred { | ||
2134 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
2135 | support::token(&self.syntax, T![lifetime]) | ||
2136 | } | ||
2137 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
2138 | } | ||
2139 | |||
2140 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2141 | pub struct WhereClause { | ||
2142 | pub(crate) syntax: SyntaxNode, | ||
2143 | } | ||
2144 | impl AstNode for WhereClause { | 2597 | impl AstNode for WhereClause { |
2145 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } | 2598 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } |
2146 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2599 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2152,15 +2605,6 @@ impl AstNode for WhereClause { | |||
2152 | } | 2605 | } |
2153 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2154 | } | 2607 | } |
2155 | impl WhereClause { | ||
2156 | pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } | ||
2157 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } | ||
2158 | } | ||
2159 | |||
2160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2161 | pub struct Abi { | ||
2162 | pub(crate) syntax: SyntaxNode, | ||
2163 | } | ||
2164 | impl AstNode for Abi { | 2608 | impl AstNode for Abi { |
2165 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 2609 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } |
2166 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2610 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2172,12 +2616,6 @@ impl AstNode for Abi { | |||
2172 | } | 2616 | } |
2173 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2617 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2174 | } | 2618 | } |
2175 | impl Abi {} | ||
2176 | |||
2177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2178 | pub struct ExprStmt { | ||
2179 | pub(crate) syntax: SyntaxNode, | ||
2180 | } | ||
2181 | impl AstNode for ExprStmt { | 2619 | impl AstNode for ExprStmt { |
2182 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } | 2620 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } |
2183 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2621 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2189,16 +2627,6 @@ impl AstNode for ExprStmt { | |||
2189 | } | 2627 | } |
2190 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2191 | } | 2629 | } |
2192 | impl ast::AttrsOwner for ExprStmt {} | ||
2193 | impl ExprStmt { | ||
2194 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2195 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
2196 | } | ||
2197 | |||
2198 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2199 | pub struct LetStmt { | ||
2200 | pub(crate) syntax: SyntaxNode, | ||
2201 | } | ||
2202 | impl AstNode for LetStmt { | 2630 | impl AstNode for LetStmt { |
2203 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } | 2631 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } |
2204 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2632 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2210,20 +2638,6 @@ impl AstNode for LetStmt { | |||
2210 | } | 2638 | } |
2211 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2639 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2212 | } | 2640 | } |
2213 | impl ast::AttrsOwner for LetStmt {} | ||
2214 | impl ast::TypeAscriptionOwner for LetStmt {} | ||
2215 | impl LetStmt { | ||
2216 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | ||
2217 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
2218 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2219 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2220 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
2221 | } | ||
2222 | |||
2223 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2224 | pub struct Condition { | ||
2225 | pub(crate) syntax: SyntaxNode, | ||
2226 | } | ||
2227 | impl AstNode for Condition { | 2641 | impl AstNode for Condition { |
2228 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } | 2642 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } |
2229 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2643 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2235,17 +2649,6 @@ impl AstNode for Condition { | |||
2235 | } | 2649 | } |
2236 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2650 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2237 | } | 2651 | } |
2238 | impl Condition { | ||
2239 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | ||
2240 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
2241 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2242 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2243 | } | ||
2244 | |||
2245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2246 | pub struct Block { | ||
2247 | pub(crate) syntax: SyntaxNode, | ||
2248 | } | ||
2249 | impl AstNode for Block { | 2652 | impl AstNode for Block { |
2250 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK } | 2653 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK } |
2251 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2654 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2257,19 +2660,6 @@ impl AstNode for Block { | |||
2257 | } | 2660 | } |
2258 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2661 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2259 | } | 2662 | } |
2260 | impl ast::AttrsOwner for Block {} | ||
2261 | impl ast::ModuleItemOwner for Block {} | ||
2262 | impl Block { | ||
2263 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
2264 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
2265 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2266 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
2267 | } | ||
2268 | |||
2269 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2270 | pub struct ParamList { | ||
2271 | pub(crate) syntax: SyntaxNode, | ||
2272 | } | ||
2273 | impl AstNode for ParamList { | 2663 | impl AstNode for ParamList { |
2274 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 2664 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
2275 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2665 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2281,17 +2671,6 @@ impl AstNode for ParamList { | |||
2281 | } | 2671 | } |
2282 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2672 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2283 | } | 2673 | } |
2284 | impl ParamList { | ||
2285 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
2286 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | ||
2287 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
2288 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
2289 | } | ||
2290 | |||
2291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2292 | pub struct SelfParam { | ||
2293 | pub(crate) syntax: SyntaxNode, | ||
2294 | } | ||
2295 | impl AstNode for SelfParam { | 2674 | impl AstNode for SelfParam { |
2296 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } | 2675 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } |
2297 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2676 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2303,21 +2682,6 @@ impl AstNode for SelfParam { | |||
2303 | } | 2682 | } |
2304 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2683 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2305 | } | 2684 | } |
2306 | impl ast::TypeAscriptionOwner for SelfParam {} | ||
2307 | impl ast::AttrsOwner for SelfParam {} | ||
2308 | impl SelfParam { | ||
2309 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
2310 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
2311 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
2312 | support::token(&self.syntax, T![lifetime]) | ||
2313 | } | ||
2314 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
2315 | } | ||
2316 | |||
2317 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2318 | pub struct Param { | ||
2319 | pub(crate) syntax: SyntaxNode, | ||
2320 | } | ||
2321 | impl AstNode for Param { | 2685 | impl AstNode for Param { |
2322 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } | 2686 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } |
2323 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2687 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2329,17 +2693,6 @@ impl AstNode for Param { | |||
2329 | } | 2693 | } |
2330 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2694 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2331 | } | 2695 | } |
2332 | impl ast::TypeAscriptionOwner for Param {} | ||
2333 | impl ast::AttrsOwner for Param {} | ||
2334 | impl Param { | ||
2335 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
2336 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
2337 | } | ||
2338 | |||
2339 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2340 | pub struct UseItem { | ||
2341 | pub(crate) syntax: SyntaxNode, | ||
2342 | } | ||
2343 | impl AstNode for UseItem { | 2696 | impl AstNode for UseItem { |
2344 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } | 2697 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } |
2345 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2698 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2351,17 +2704,6 @@ impl AstNode for UseItem { | |||
2351 | } | 2704 | } |
2352 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2705 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2353 | } | 2706 | } |
2354 | impl ast::AttrsOwner for UseItem {} | ||
2355 | impl ast::VisibilityOwner for UseItem {} | ||
2356 | impl UseItem { | ||
2357 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } | ||
2358 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | ||
2359 | } | ||
2360 | |||
2361 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2362 | pub struct UseTree { | ||
2363 | pub(crate) syntax: SyntaxNode, | ||
2364 | } | ||
2365 | impl AstNode for UseTree { | 2707 | impl AstNode for UseTree { |
2366 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } | 2708 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } |
2367 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2709 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2373,17 +2715,6 @@ impl AstNode for UseTree { | |||
2373 | } | 2715 | } |
2374 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2716 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2375 | } | 2717 | } |
2376 | impl UseTree { | ||
2377 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
2378 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | ||
2379 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | ||
2380 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
2381 | } | ||
2382 | |||
2383 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2384 | pub struct Alias { | ||
2385 | pub(crate) syntax: SyntaxNode, | ||
2386 | } | ||
2387 | impl AstNode for Alias { | 2718 | impl AstNode for Alias { |
2388 | fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS } | 2719 | fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS } |
2389 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2720 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2395,15 +2726,6 @@ impl AstNode for Alias { | |||
2395 | } | 2726 | } |
2396 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2727 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2397 | } | 2728 | } |
2398 | impl ast::NameOwner for Alias {} | ||
2399 | impl Alias { | ||
2400 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
2401 | } | ||
2402 | |||
2403 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2404 | pub struct UseTreeList { | ||
2405 | pub(crate) syntax: SyntaxNode, | ||
2406 | } | ||
2407 | impl AstNode for UseTreeList { | 2729 | impl AstNode for UseTreeList { |
2408 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } | 2730 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } |
2409 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2731 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2415,16 +2737,6 @@ impl AstNode for UseTreeList { | |||
2415 | } | 2737 | } |
2416 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2738 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2417 | } | 2739 | } |
2418 | impl UseTreeList { | ||
2419 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
2420 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | ||
2421 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
2422 | } | ||
2423 | |||
2424 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2425 | pub struct ExternCrateItem { | ||
2426 | pub(crate) syntax: SyntaxNode, | ||
2427 | } | ||
2428 | impl AstNode for ExternCrateItem { | 2740 | impl AstNode for ExternCrateItem { |
2429 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } | 2741 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } |
2430 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2742 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2436,19 +2748,6 @@ impl AstNode for ExternCrateItem { | |||
2436 | } | 2748 | } |
2437 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2749 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2438 | } | 2750 | } |
2439 | impl ast::AttrsOwner for ExternCrateItem {} | ||
2440 | impl ast::VisibilityOwner for ExternCrateItem {} | ||
2441 | impl ExternCrateItem { | ||
2442 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | ||
2443 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
2444 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
2445 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
2446 | } | ||
2447 | |||
2448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2449 | pub struct ArgList { | ||
2450 | pub(crate) syntax: SyntaxNode, | ||
2451 | } | ||
2452 | impl AstNode for ArgList { | 2751 | impl AstNode for ArgList { |
2453 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } | 2752 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } |
2454 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2753 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2460,16 +2759,6 @@ impl AstNode for ArgList { | |||
2460 | } | 2759 | } |
2461 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2760 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2462 | } | 2761 | } |
2463 | impl ArgList { | ||
2464 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
2465 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
2466 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
2467 | } | ||
2468 | |||
2469 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2470 | pub struct Path { | ||
2471 | pub(crate) syntax: SyntaxNode, | ||
2472 | } | ||
2473 | impl AstNode for Path { | 2762 | impl AstNode for Path { |
2474 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } | 2763 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } |
2475 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2764 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2481,15 +2770,6 @@ impl AstNode for Path { | |||
2481 | } | 2770 | } |
2482 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2771 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2483 | } | 2772 | } |
2484 | impl Path { | ||
2485 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
2486 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
2487 | } | ||
2488 | |||
2489 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2490 | pub struct PathSegment { | ||
2491 | pub(crate) syntax: SyntaxNode, | ||
2492 | } | ||
2493 | impl AstNode for PathSegment { | 2773 | impl AstNode for PathSegment { |
2494 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2774 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
2495 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2775 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2501,21 +2781,6 @@ impl AstNode for PathSegment { | |||
2501 | } | 2781 | } |
2502 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2782 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2503 | } | 2783 | } |
2504 | impl PathSegment { | ||
2505 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
2506 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
2507 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
2508 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
2509 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
2510 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
2511 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | ||
2512 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
2513 | } | ||
2514 | |||
2515 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2516 | pub struct TypeArgList { | ||
2517 | pub(crate) syntax: SyntaxNode, | ||
2518 | } | ||
2519 | impl AstNode for TypeArgList { | 2784 | impl AstNode for TypeArgList { |
2520 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } | 2785 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } |
2521 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2786 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2527,21 +2792,6 @@ impl AstNode for TypeArgList { | |||
2527 | } | 2792 | } |
2528 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2793 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2529 | } | 2794 | } |
2530 | impl TypeArgList { | ||
2531 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
2532 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
2533 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } | ||
2534 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } | ||
2535 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } | ||
2536 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } | ||
2537 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } | ||
2538 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
2539 | } | ||
2540 | |||
2541 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2542 | pub struct TypeArg { | ||
2543 | pub(crate) syntax: SyntaxNode, | ||
2544 | } | ||
2545 | impl AstNode for TypeArg { | 2795 | impl AstNode for TypeArg { |
2546 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } | 2796 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } |
2547 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2797 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2553,14 +2803,6 @@ impl AstNode for TypeArg { | |||
2553 | } | 2803 | } |
2554 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2804 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2555 | } | 2805 | } |
2556 | impl TypeArg { | ||
2557 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
2558 | } | ||
2559 | |||
2560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2561 | pub struct AssocTypeArg { | ||
2562 | pub(crate) syntax: SyntaxNode, | ||
2563 | } | ||
2564 | impl AstNode for AssocTypeArg { | 2806 | impl AstNode for AssocTypeArg { |
2565 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } | 2807 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } |
2566 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2808 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2572,17 +2814,6 @@ impl AstNode for AssocTypeArg { | |||
2572 | } | 2814 | } |
2573 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2815 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2574 | } | 2816 | } |
2575 | impl ast::TypeBoundsOwner for AssocTypeArg {} | ||
2576 | impl AssocTypeArg { | ||
2577 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
2578 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2579 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
2580 | } | ||
2581 | |||
2582 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2583 | pub struct LifetimeArg { | ||
2584 | pub(crate) syntax: SyntaxNode, | ||
2585 | } | ||
2586 | impl AstNode for LifetimeArg { | 2817 | impl AstNode for LifetimeArg { |
2587 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } | 2818 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } |
2588 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2819 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2594,16 +2825,6 @@ impl AstNode for LifetimeArg { | |||
2594 | } | 2825 | } |
2595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2826 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2596 | } | 2827 | } |
2597 | impl LifetimeArg { | ||
2598 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
2599 | support::token(&self.syntax, T![lifetime]) | ||
2600 | } | ||
2601 | } | ||
2602 | |||
2603 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2604 | pub struct ConstArg { | ||
2605 | pub(crate) syntax: SyntaxNode, | ||
2606 | } | ||
2607 | impl AstNode for ConstArg { | 2828 | impl AstNode for ConstArg { |
2608 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } | 2829 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } |
2609 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2830 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2615,16 +2836,6 @@ impl AstNode for ConstArg { | |||
2615 | } | 2836 | } |
2616 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2837 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2617 | } | 2838 | } |
2618 | impl ConstArg { | ||
2619 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | ||
2620 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2621 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
2622 | } | ||
2623 | |||
2624 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2625 | pub struct MacroItems { | ||
2626 | pub(crate) syntax: SyntaxNode, | ||
2627 | } | ||
2628 | impl AstNode for MacroItems { | 2839 | impl AstNode for MacroItems { |
2629 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } | 2840 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } |
2630 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2841 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2636,13 +2847,6 @@ impl AstNode for MacroItems { | |||
2636 | } | 2847 | } |
2637 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2848 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2638 | } | 2849 | } |
2639 | impl ast::ModuleItemOwner for MacroItems {} | ||
2640 | impl MacroItems {} | ||
2641 | |||
2642 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2643 | pub struct MacroStmts { | ||
2644 | pub(crate) syntax: SyntaxNode, | ||
2645 | } | ||
2646 | impl AstNode for MacroStmts { | 2850 | impl AstNode for MacroStmts { |
2647 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } | 2851 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } |
2648 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2852 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2654,15 +2858,6 @@ impl AstNode for MacroStmts { | |||
2654 | } | 2858 | } |
2655 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2859 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2656 | } | 2860 | } |
2657 | impl MacroStmts { | ||
2658 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
2659 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2660 | } | ||
2661 | |||
2662 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2663 | pub struct ExternItemList { | ||
2664 | pub(crate) syntax: SyntaxNode, | ||
2665 | } | ||
2666 | impl AstNode for ExternItemList { | 2861 | impl AstNode for ExternItemList { |
2667 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | 2862 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } |
2668 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2863 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2674,17 +2869,6 @@ impl AstNode for ExternItemList { | |||
2674 | } | 2869 | } |
2675 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2870 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2676 | } | 2871 | } |
2677 | impl ast::ModuleItemOwner for ExternItemList {} | ||
2678 | impl ExternItemList { | ||
2679 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
2680 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | ||
2681 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
2682 | } | ||
2683 | |||
2684 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2685 | pub struct ExternBlock { | ||
2686 | pub(crate) syntax: SyntaxNode, | ||
2687 | } | ||
2688 | impl AstNode for ExternBlock { | 2872 | impl AstNode for ExternBlock { |
2689 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } | 2873 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } |
2690 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2874 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2696,15 +2880,6 @@ impl AstNode for ExternBlock { | |||
2696 | } | 2880 | } |
2697 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2881 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2698 | } | 2882 | } |
2699 | impl ExternBlock { | ||
2700 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
2701 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | ||
2702 | } | ||
2703 | |||
2704 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2705 | pub struct MetaItem { | ||
2706 | pub(crate) syntax: SyntaxNode, | ||
2707 | } | ||
2708 | impl AstNode for MetaItem { | 2883 | impl AstNode for MetaItem { |
2709 | fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM } | 2884 | fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM } |
2710 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2885 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2716,17 +2891,6 @@ impl AstNode for MetaItem { | |||
2716 | } | 2891 | } |
2717 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2892 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2718 | } | 2893 | } |
2719 | impl MetaItem { | ||
2720 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
2721 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
2722 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | ||
2723 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | ||
2724 | } | ||
2725 | |||
2726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2727 | pub struct MacroDef { | ||
2728 | pub(crate) syntax: SyntaxNode, | ||
2729 | } | ||
2730 | impl AstNode for MacroDef { | 2894 | impl AstNode for MacroDef { |
2731 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } | 2895 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } |
2732 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2896 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2738,17 +2902,6 @@ impl AstNode for MacroDef { | |||
2738 | } | 2902 | } |
2739 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2903 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2740 | } | 2904 | } |
2741 | impl MacroDef { | ||
2742 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } | ||
2743 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
2744 | } | ||
2745 | |||
2746 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2747 | pub enum NominalDef { | ||
2748 | StructDef(StructDef), | ||
2749 | EnumDef(EnumDef), | ||
2750 | UnionDef(UnionDef), | ||
2751 | } | ||
2752 | impl From<StructDef> for NominalDef { | 2905 | impl From<StructDef> for NominalDef { |
2753 | fn from(node: StructDef) -> NominalDef { NominalDef::StructDef(node) } | 2906 | fn from(node: StructDef) -> NominalDef { NominalDef::StructDef(node) } |
2754 | } | 2907 | } |
@@ -2782,16 +2935,6 @@ impl AstNode for NominalDef { | |||
2782 | } | 2935 | } |
2783 | } | 2936 | } |
2784 | } | 2937 | } |
2785 | impl ast::NameOwner for NominalDef {} | ||
2786 | impl ast::TypeParamsOwner for NominalDef {} | ||
2787 | impl ast::AttrsOwner for NominalDef {} | ||
2788 | |||
2789 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2790 | pub enum GenericParam { | ||
2791 | LifetimeParam(LifetimeParam), | ||
2792 | TypeParam(TypeParam), | ||
2793 | ConstParam(ConstParam), | ||
2794 | } | ||
2795 | impl From<LifetimeParam> for GenericParam { | 2938 | impl From<LifetimeParam> for GenericParam { |
2796 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } | 2939 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } |
2797 | } | 2940 | } |
@@ -2825,14 +2968,6 @@ impl AstNode for GenericParam { | |||
2825 | } | 2968 | } |
2826 | } | 2969 | } |
2827 | } | 2970 | } |
2828 | |||
2829 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2830 | pub enum GenericArg { | ||
2831 | LifetimeArg(LifetimeArg), | ||
2832 | TypeArg(TypeArg), | ||
2833 | ConstArg(ConstArg), | ||
2834 | AssocTypeArg(AssocTypeArg), | ||
2835 | } | ||
2836 | impl From<LifetimeArg> for GenericArg { | 2971 | impl From<LifetimeArg> for GenericArg { |
2837 | fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } | 2972 | fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } |
2838 | } | 2973 | } |
@@ -2871,23 +3006,6 @@ impl AstNode for GenericArg { | |||
2871 | } | 3006 | } |
2872 | } | 3007 | } |
2873 | } | 3008 | } |
2874 | |||
2875 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2876 | pub enum TypeRef { | ||
2877 | ParenType(ParenType), | ||
2878 | TupleType(TupleType), | ||
2879 | NeverType(NeverType), | ||
2880 | PathType(PathType), | ||
2881 | PointerType(PointerType), | ||
2882 | ArrayType(ArrayType), | ||
2883 | SliceType(SliceType), | ||
2884 | ReferenceType(ReferenceType), | ||
2885 | PlaceholderType(PlaceholderType), | ||
2886 | FnPointerType(FnPointerType), | ||
2887 | ForType(ForType), | ||
2888 | ImplTraitType(ImplTraitType), | ||
2889 | DynTraitType(DynTraitType), | ||
2890 | } | ||
2891 | impl From<ParenType> for TypeRef { | 3009 | impl From<ParenType> for TypeRef { |
2892 | fn from(node: ParenType) -> TypeRef { TypeRef::ParenType(node) } | 3010 | fn from(node: ParenType) -> TypeRef { TypeRef::ParenType(node) } |
2893 | } | 3011 | } |
@@ -2973,24 +3091,6 @@ impl AstNode for TypeRef { | |||
2973 | } | 3091 | } |
2974 | } | 3092 | } |
2975 | } | 3093 | } |
2976 | |||
2977 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2978 | pub enum ModuleItem { | ||
2979 | StructDef(StructDef), | ||
2980 | UnionDef(UnionDef), | ||
2981 | EnumDef(EnumDef), | ||
2982 | FnDef(FnDef), | ||
2983 | TraitDef(TraitDef), | ||
2984 | TypeAliasDef(TypeAliasDef), | ||
2985 | ImplDef(ImplDef), | ||
2986 | UseItem(UseItem), | ||
2987 | ExternCrateItem(ExternCrateItem), | ||
2988 | ConstDef(ConstDef), | ||
2989 | StaticDef(StaticDef), | ||
2990 | Module(Module), | ||
2991 | MacroCall(MacroCall), | ||
2992 | ExternBlock(ExternBlock), | ||
2993 | } | ||
2994 | impl From<StructDef> for ModuleItem { | 3094 | impl From<StructDef> for ModuleItem { |
2995 | fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) } | 3095 | fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) } |
2996 | } | 3096 | } |
@@ -3081,16 +3181,6 @@ impl AstNode for ModuleItem { | |||
3081 | } | 3181 | } |
3082 | } | 3182 | } |
3083 | } | 3183 | } |
3084 | impl ast::NameOwner for ModuleItem {} | ||
3085 | impl ast::AttrsOwner for ModuleItem {} | ||
3086 | impl ast::VisibilityOwner for ModuleItem {} | ||
3087 | |||
3088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3089 | pub enum ImplItem { | ||
3090 | FnDef(FnDef), | ||
3091 | TypeAliasDef(TypeAliasDef), | ||
3092 | ConstDef(ConstDef), | ||
3093 | } | ||
3094 | impl From<FnDef> for ImplItem { | 3184 | impl From<FnDef> for ImplItem { |
3095 | fn from(node: FnDef) -> ImplItem { ImplItem::FnDef(node) } | 3185 | fn from(node: FnDef) -> ImplItem { ImplItem::FnDef(node) } |
3096 | } | 3186 | } |
@@ -3124,14 +3214,6 @@ impl AstNode for ImplItem { | |||
3124 | } | 3214 | } |
3125 | } | 3215 | } |
3126 | } | 3216 | } |
3127 | impl ast::NameOwner for ImplItem {} | ||
3128 | impl ast::AttrsOwner for ImplItem {} | ||
3129 | |||
3130 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3131 | pub enum ExternItem { | ||
3132 | FnDef(FnDef), | ||
3133 | StaticDef(StaticDef), | ||
3134 | } | ||
3135 | impl From<FnDef> for ExternItem { | 3217 | impl From<FnDef> for ExternItem { |
3136 | fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) } | 3218 | fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) } |
3137 | } | 3219 | } |
@@ -3160,44 +3242,6 @@ impl AstNode for ExternItem { | |||
3160 | } | 3242 | } |
3161 | } | 3243 | } |
3162 | } | 3244 | } |
3163 | impl ast::NameOwner for ExternItem {} | ||
3164 | impl ast::AttrsOwner for ExternItem {} | ||
3165 | impl ast::VisibilityOwner for ExternItem {} | ||
3166 | |||
3167 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3168 | pub enum Expr { | ||
3169 | TupleExpr(TupleExpr), | ||
3170 | ArrayExpr(ArrayExpr), | ||
3171 | ParenExpr(ParenExpr), | ||
3172 | PathExpr(PathExpr), | ||
3173 | LambdaExpr(LambdaExpr), | ||
3174 | IfExpr(IfExpr), | ||
3175 | LoopExpr(LoopExpr), | ||
3176 | ForExpr(ForExpr), | ||
3177 | WhileExpr(WhileExpr), | ||
3178 | ContinueExpr(ContinueExpr), | ||
3179 | BreakExpr(BreakExpr), | ||
3180 | Label(Label), | ||
3181 | BlockExpr(BlockExpr), | ||
3182 | ReturnExpr(ReturnExpr), | ||
3183 | MatchExpr(MatchExpr), | ||
3184 | RecordLit(RecordLit), | ||
3185 | CallExpr(CallExpr), | ||
3186 | IndexExpr(IndexExpr), | ||
3187 | MethodCallExpr(MethodCallExpr), | ||
3188 | FieldExpr(FieldExpr), | ||
3189 | AwaitExpr(AwaitExpr), | ||
3190 | TryExpr(TryExpr), | ||
3191 | TryBlockExpr(TryBlockExpr), | ||
3192 | CastExpr(CastExpr), | ||
3193 | RefExpr(RefExpr), | ||
3194 | PrefixExpr(PrefixExpr), | ||
3195 | RangeExpr(RangeExpr), | ||
3196 | BinExpr(BinExpr), | ||
3197 | Literal(Literal), | ||
3198 | MacroCall(MacroCall), | ||
3199 | BoxExpr(BoxExpr), | ||
3200 | } | ||
3201 | impl From<TupleExpr> for Expr { | 3245 | impl From<TupleExpr> for Expr { |
3202 | fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } | 3246 | fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } |
3203 | } | 3247 | } |
@@ -3376,26 +3420,6 @@ impl AstNode for Expr { | |||
3376 | } | 3420 | } |
3377 | } | 3421 | } |
3378 | } | 3422 | } |
3379 | impl ast::AttrsOwner for Expr {} | ||
3380 | |||
3381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3382 | pub enum Pat { | ||
3383 | OrPat(OrPat), | ||
3384 | ParenPat(ParenPat), | ||
3385 | RefPat(RefPat), | ||
3386 | BoxPat(BoxPat), | ||
3387 | BindPat(BindPat), | ||
3388 | PlaceholderPat(PlaceholderPat), | ||
3389 | DotDotPat(DotDotPat), | ||
3390 | PathPat(PathPat), | ||
3391 | RecordPat(RecordPat), | ||
3392 | TupleStructPat(TupleStructPat), | ||
3393 | TuplePat(TuplePat), | ||
3394 | SlicePat(SlicePat), | ||
3395 | RangePat(RangePat), | ||
3396 | LiteralPat(LiteralPat), | ||
3397 | MacroPat(MacroPat), | ||
3398 | } | ||
3399 | impl From<OrPat> for Pat { | 3423 | impl From<OrPat> for Pat { |
3400 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } | 3424 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } |
3401 | } | 3425 | } |
@@ -3491,12 +3515,6 @@ impl AstNode for Pat { | |||
3491 | } | 3515 | } |
3492 | } | 3516 | } |
3493 | } | 3517 | } |
3494 | |||
3495 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3496 | pub enum RecordInnerPat { | ||
3497 | RecordFieldPat(RecordFieldPat), | ||
3498 | BindPat(BindPat), | ||
3499 | } | ||
3500 | impl From<RecordFieldPat> for RecordInnerPat { | 3518 | impl From<RecordFieldPat> for RecordInnerPat { |
3501 | fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) } | 3519 | fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) } |
3502 | } | 3520 | } |
@@ -3525,12 +3543,6 @@ impl AstNode for RecordInnerPat { | |||
3525 | } | 3543 | } |
3526 | } | 3544 | } |
3527 | } | 3545 | } |
3528 | |||
3529 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3530 | pub enum AttrInput { | ||
3531 | Literal(Literal), | ||
3532 | TokenTree(TokenTree), | ||
3533 | } | ||
3534 | impl From<Literal> for AttrInput { | 3546 | impl From<Literal> for AttrInput { |
3535 | fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } | 3547 | fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } |
3536 | } | 3548 | } |
@@ -3559,12 +3571,6 @@ impl AstNode for AttrInput { | |||
3559 | } | 3571 | } |
3560 | } | 3572 | } |
3561 | } | 3573 | } |
3562 | |||
3563 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3564 | pub enum Stmt { | ||
3565 | LetStmt(LetStmt), | ||
3566 | ExprStmt(ExprStmt), | ||
3567 | } | ||
3568 | impl From<LetStmt> for Stmt { | 3574 | impl From<LetStmt> for Stmt { |
3569 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } | 3575 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } |
3570 | } | 3576 | } |
@@ -3593,12 +3599,6 @@ impl AstNode for Stmt { | |||
3593 | } | 3599 | } |
3594 | } | 3600 | } |
3595 | } | 3601 | } |
3596 | |||
3597 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3598 | pub enum FieldDefList { | ||
3599 | RecordFieldDefList(RecordFieldDefList), | ||
3600 | TupleFieldDefList(TupleFieldDefList), | ||
3601 | } | ||
3602 | impl From<RecordFieldDefList> for FieldDefList { | 3602 | impl From<RecordFieldDefList> for FieldDefList { |
3603 | fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } | 3603 | fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } |
3604 | } | 3604 | } |