aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs627
1 files changed, 111 insertions, 516 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 47a37e4d1..4afe1a146 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -376,64 +376,6 @@ impl BreakExpr {
376 } 376 }
377} 377}
378 378
379// Byte
380#[derive(Debug, PartialEq, Eq, Hash)]
381#[repr(transparent)]
382pub struct Byte {
383 pub(crate) syntax: SyntaxNode,
384}
385unsafe impl TransparentNewType for Byte {
386 type Repr = rowan::SyntaxNode<RaTypes>;
387}
388
389impl AstNode for Byte {
390 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
391 match syntax.kind() {
392 BYTE => Some(Byte::from_repr(syntax.into_repr())),
393 _ => None,
394 }
395 }
396 fn syntax(&self) -> &SyntaxNode { &self.syntax }
397}
398
399impl ToOwned for Byte {
400 type Owned = TreeArc<Byte>;
401 fn to_owned(&self) -> TreeArc<Byte> { TreeArc::cast(self.syntax.to_owned()) }
402}
403
404
405impl ast::AstToken for Byte {}
406impl Byte {}
407
408// ByteString
409#[derive(Debug, PartialEq, Eq, Hash)]
410#[repr(transparent)]
411pub struct ByteString {
412 pub(crate) syntax: SyntaxNode,
413}
414unsafe impl TransparentNewType for ByteString {
415 type Repr = rowan::SyntaxNode<RaTypes>;
416}
417
418impl AstNode for ByteString {
419 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
420 match syntax.kind() {
421 BYTE_STRING => Some(ByteString::from_repr(syntax.into_repr())),
422 _ => None,
423 }
424 }
425 fn syntax(&self) -> &SyntaxNode { &self.syntax }
426}
427
428impl ToOwned for ByteString {
429 type Owned = TreeArc<ByteString>;
430 fn to_owned(&self) -> TreeArc<ByteString> { TreeArc::cast(self.syntax.to_owned()) }
431}
432
433
434impl ast::AstToken for ByteString {}
435impl ByteString {}
436
437// CallExpr 379// CallExpr
438#[derive(Debug, PartialEq, Eq, Hash)] 380#[derive(Debug, PartialEq, Eq, Hash)]
439#[repr(transparent)] 381#[repr(transparent)]
@@ -503,64 +445,6 @@ impl CastExpr {
503 } 445 }
504} 446}
505 447
506// Char
507#[derive(Debug, PartialEq, Eq, Hash)]
508#[repr(transparent)]
509pub struct Char {
510 pub(crate) syntax: SyntaxNode,
511}
512unsafe impl TransparentNewType for Char {
513 type Repr = rowan::SyntaxNode<RaTypes>;
514}
515
516impl AstNode for Char {
517 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
518 match syntax.kind() {
519 CHAR => Some(Char::from_repr(syntax.into_repr())),
520 _ => None,
521 }
522 }
523 fn syntax(&self) -> &SyntaxNode { &self.syntax }
524}
525
526impl ToOwned for Char {
527 type Owned = TreeArc<Char>;
528 fn to_owned(&self) -> TreeArc<Char> { TreeArc::cast(self.syntax.to_owned()) }
529}
530
531
532impl ast::AstToken for Char {}
533impl Char {}
534
535// Comment
536#[derive(Debug, PartialEq, Eq, Hash)]
537#[repr(transparent)]
538pub struct Comment {
539 pub(crate) syntax: SyntaxNode,
540}
541unsafe impl TransparentNewType for Comment {
542 type Repr = rowan::SyntaxNode<RaTypes>;
543}
544
545impl AstNode for Comment {
546 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
547 match syntax.kind() {
548 COMMENT => Some(Comment::from_repr(syntax.into_repr())),
549 _ => None,
550 }
551 }
552 fn syntax(&self) -> &SyntaxNode { &self.syntax }
553}
554
555impl ToOwned for Comment {
556 type Owned = TreeArc<Comment>;
557 fn to_owned(&self) -> TreeArc<Comment> { TreeArc::cast(self.syntax.to_owned()) }
558}
559
560
561impl ast::AstToken for Comment {}
562impl Comment {}
563
564// Condition 448// Condition
565#[derive(Debug, PartialEq, Eq, Hash)] 449#[derive(Debug, PartialEq, Eq, Hash)]
566#[repr(transparent)] 450#[repr(transparent)]
@@ -685,6 +569,7 @@ impl ToOwned for DynTraitType {
685} 569}
686 570
687 571
572impl ast::TypeBoundsOwner for DynTraitType {}
688impl DynTraitType {} 573impl DynTraitType {}
689 574
690// EnumDef 575// EnumDef
@@ -1114,35 +999,6 @@ impl ExternCrateItem {
1114 } 999 }
1115} 1000}
1116 1001
1117// FalseKw
1118#[derive(Debug, PartialEq, Eq, Hash)]
1119#[repr(transparent)]
1120pub struct FalseKw {
1121 pub(crate) syntax: SyntaxNode,
1122}
1123unsafe impl TransparentNewType for FalseKw {
1124 type Repr = rowan::SyntaxNode<RaTypes>;
1125}
1126
1127impl AstNode for FalseKw {
1128 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1129 match syntax.kind() {
1130 FALSE_KW => Some(FalseKw::from_repr(syntax.into_repr())),
1131 _ => None,
1132 }
1133 }
1134 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1135}
1136
1137impl ToOwned for FalseKw {
1138 type Owned = TreeArc<FalseKw>;
1139 fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) }
1140}
1141
1142
1143impl ast::AstToken for FalseKw {}
1144impl FalseKw {}
1145
1146// FieldExpr 1002// FieldExpr
1147#[derive(Debug, PartialEq, Eq, Hash)] 1003#[derive(Debug, PartialEq, Eq, Hash)]
1148#[repr(transparent)] 1004#[repr(transparent)]
@@ -1248,35 +1104,6 @@ impl FieldPatList {
1248 } 1104 }
1249} 1105}
1250 1106
1251// FloatNumber
1252#[derive(Debug, PartialEq, Eq, Hash)]
1253#[repr(transparent)]
1254pub struct FloatNumber {
1255 pub(crate) syntax: SyntaxNode,
1256}
1257unsafe impl TransparentNewType for FloatNumber {
1258 type Repr = rowan::SyntaxNode<RaTypes>;
1259}
1260
1261impl AstNode for FloatNumber {
1262 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1263 match syntax.kind() {
1264 FLOAT_NUMBER => Some(FloatNumber::from_repr(syntax.into_repr())),
1265 _ => None,
1266 }
1267 }
1268 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1269}
1270
1271impl ToOwned for FloatNumber {
1272 type Owned = TreeArc<FloatNumber>;
1273 fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) }
1274}
1275
1276
1277impl ast::AstToken for FloatNumber {}
1278impl FloatNumber {}
1279
1280// FnDef 1107// FnDef
1281#[derive(Debug, PartialEq, Eq, Hash)] 1108#[derive(Debug, PartialEq, Eq, Hash)]
1282#[repr(transparent)] 1109#[repr(transparent)]
@@ -1581,6 +1408,7 @@ impl ToOwned for ImplTraitType {
1581} 1408}
1582 1409
1583 1410
1411impl ast::TypeBoundsOwner for ImplTraitType {}
1584impl ImplTraitType {} 1412impl ImplTraitType {}
1585 1413
1586// IndexExpr 1414// IndexExpr
@@ -1611,35 +1439,6 @@ impl ToOwned for IndexExpr {
1611 1439
1612impl IndexExpr {} 1440impl IndexExpr {}
1613 1441
1614// IntNumber
1615#[derive(Debug, PartialEq, Eq, Hash)]
1616#[repr(transparent)]
1617pub struct IntNumber {
1618 pub(crate) syntax: SyntaxNode,
1619}
1620unsafe impl TransparentNewType for IntNumber {
1621 type Repr = rowan::SyntaxNode<RaTypes>;
1622}
1623
1624impl AstNode for IntNumber {
1625 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1626 match syntax.kind() {
1627 INT_NUMBER => Some(IntNumber::from_repr(syntax.into_repr())),
1628 _ => None,
1629 }
1630 }
1631 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1632}
1633
1634impl ToOwned for IntNumber {
1635 type Owned = TreeArc<IntNumber>;
1636 fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) }
1637}
1638
1639
1640impl ast::AstToken for IntNumber {}
1641impl IntNumber {}
1642
1643// ItemList 1442// ItemList
1644#[derive(Debug, PartialEq, Eq, Hash)] 1443#[derive(Debug, PartialEq, Eq, Hash)]
1645#[repr(transparent)] 1444#[repr(transparent)]
@@ -1775,35 +1574,6 @@ impl LetStmt {
1775 } 1574 }
1776} 1575}
1777 1576
1778// Lifetime
1779#[derive(Debug, PartialEq, Eq, Hash)]
1780#[repr(transparent)]
1781pub struct Lifetime {
1782 pub(crate) syntax: SyntaxNode,
1783}
1784unsafe impl TransparentNewType for Lifetime {
1785 type Repr = rowan::SyntaxNode<RaTypes>;
1786}
1787
1788impl AstNode for Lifetime {
1789 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1790 match syntax.kind() {
1791 LIFETIME => Some(Lifetime::from_repr(syntax.into_repr())),
1792 _ => None,
1793 }
1794 }
1795 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1796}
1797
1798impl ToOwned for Lifetime {
1799 type Owned = TreeArc<Lifetime>;
1800 fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) }
1801}
1802
1803
1804impl ast::AstToken for Lifetime {}
1805impl Lifetime {}
1806
1807// LifetimeArg 1577// LifetimeArg
1808#[derive(Debug, PartialEq, Eq, Hash)] 1578#[derive(Debug, PartialEq, Eq, Hash)]
1809#[repr(transparent)] 1579#[repr(transparent)]
@@ -1830,11 +1600,7 @@ impl ToOwned for LifetimeArg {
1830} 1600}
1831 1601
1832 1602
1833impl LifetimeArg { 1603impl LifetimeArg {}
1834 pub fn lifetime(&self) -> Option<&Lifetime> {
1835 super::child_opt(self)
1836 }
1837}
1838 1604
1839// LifetimeParam 1605// LifetimeParam
1840#[derive(Debug, PartialEq, Eq, Hash)] 1606#[derive(Debug, PartialEq, Eq, Hash)]
@@ -1863,11 +1629,7 @@ impl ToOwned for LifetimeParam {
1863 1629
1864 1630
1865impl ast::AttrsOwner for LifetimeParam {} 1631impl ast::AttrsOwner for LifetimeParam {}
1866impl LifetimeParam { 1632impl LifetimeParam {}
1867 pub fn lifetime(&self) -> Option<&Lifetime> {
1868 super::child_opt(self)
1869 }
1870}
1871 1633
1872// Literal 1634// Literal
1873#[derive(Debug, PartialEq, Eq, Hash)] 1635#[derive(Debug, PartialEq, Eq, Hash)]
@@ -1895,130 +1657,7 @@ impl ToOwned for Literal {
1895} 1657}
1896 1658
1897 1659
1898impl Literal { 1660impl Literal {}
1899 pub fn literal_expr(&self) -> Option<&LiteralExpr> {
1900 super::child_opt(self)
1901 }
1902}
1903
1904// LiteralExpr
1905#[derive(Debug, PartialEq, Eq, Hash)]
1906#[repr(transparent)]
1907pub struct LiteralExpr {
1908 pub(crate) syntax: SyntaxNode,
1909}
1910unsafe impl TransparentNewType for LiteralExpr {
1911 type Repr = rowan::SyntaxNode<RaTypes>;
1912}
1913
1914#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1915pub enum LiteralExprKind<'a> {
1916 String(&'a String),
1917 ByteString(&'a ByteString),
1918 RawString(&'a RawString),
1919 RawByteString(&'a RawByteString),
1920 Char(&'a Char),
1921 Byte(&'a Byte),
1922 IntNumber(&'a IntNumber),
1923 FloatNumber(&'a FloatNumber),
1924 TrueKw(&'a TrueKw),
1925 FalseKw(&'a FalseKw),
1926}
1927impl<'a> From<&'a String> for &'a LiteralExpr {
1928 fn from(n: &'a String) -> &'a LiteralExpr {
1929 LiteralExpr::cast(&n.syntax).unwrap()
1930 }
1931}
1932impl<'a> From<&'a ByteString> for &'a LiteralExpr {
1933 fn from(n: &'a ByteString) -> &'a LiteralExpr {
1934 LiteralExpr::cast(&n.syntax).unwrap()
1935 }
1936}
1937impl<'a> From<&'a RawString> for &'a LiteralExpr {
1938 fn from(n: &'a RawString) -> &'a LiteralExpr {
1939 LiteralExpr::cast(&n.syntax).unwrap()
1940 }
1941}
1942impl<'a> From<&'a RawByteString> for &'a LiteralExpr {
1943 fn from(n: &'a RawByteString) -> &'a LiteralExpr {
1944 LiteralExpr::cast(&n.syntax).unwrap()
1945 }
1946}
1947impl<'a> From<&'a Char> for &'a LiteralExpr {
1948 fn from(n: &'a Char) -> &'a LiteralExpr {
1949 LiteralExpr::cast(&n.syntax).unwrap()
1950 }
1951}
1952impl<'a> From<&'a Byte> for &'a LiteralExpr {
1953 fn from(n: &'a Byte) -> &'a LiteralExpr {
1954 LiteralExpr::cast(&n.syntax).unwrap()
1955 }
1956}
1957impl<'a> From<&'a IntNumber> for &'a LiteralExpr {
1958 fn from(n: &'a IntNumber) -> &'a LiteralExpr {
1959 LiteralExpr::cast(&n.syntax).unwrap()
1960 }
1961}
1962impl<'a> From<&'a FloatNumber> for &'a LiteralExpr {
1963 fn from(n: &'a FloatNumber) -> &'a LiteralExpr {
1964 LiteralExpr::cast(&n.syntax).unwrap()
1965 }
1966}
1967impl<'a> From<&'a TrueKw> for &'a LiteralExpr {
1968 fn from(n: &'a TrueKw) -> &'a LiteralExpr {
1969 LiteralExpr::cast(&n.syntax).unwrap()
1970 }
1971}
1972impl<'a> From<&'a FalseKw> for &'a LiteralExpr {
1973 fn from(n: &'a FalseKw) -> &'a LiteralExpr {
1974 LiteralExpr::cast(&n.syntax).unwrap()
1975 }
1976}
1977
1978
1979impl AstNode for LiteralExpr {
1980 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1981 match syntax.kind() {
1982 | STRING
1983 | BYTE_STRING
1984 | RAW_STRING
1985 | RAW_BYTE_STRING
1986 | CHAR
1987 | BYTE
1988 | INT_NUMBER
1989 | FLOAT_NUMBER
1990 | TRUE_KW
1991 | FALSE_KW => Some(LiteralExpr::from_repr(syntax.into_repr())),
1992 _ => None,
1993 }
1994 }
1995 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1996}
1997
1998impl ToOwned for LiteralExpr {
1999 type Owned = TreeArc<LiteralExpr>;
2000 fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) }
2001}
2002
2003impl LiteralExpr {
2004 pub fn kind(&self) -> LiteralExprKind {
2005 match self.syntax.kind() {
2006 STRING => LiteralExprKind::String(String::cast(&self.syntax).unwrap()),
2007 BYTE_STRING => LiteralExprKind::ByteString(ByteString::cast(&self.syntax).unwrap()),
2008 RAW_STRING => LiteralExprKind::RawString(RawString::cast(&self.syntax).unwrap()),
2009 RAW_BYTE_STRING => LiteralExprKind::RawByteString(RawByteString::cast(&self.syntax).unwrap()),
2010 CHAR => LiteralExprKind::Char(Char::cast(&self.syntax).unwrap()),
2011 BYTE => LiteralExprKind::Byte(Byte::cast(&self.syntax).unwrap()),
2012 INT_NUMBER => LiteralExprKind::IntNumber(IntNumber::cast(&self.syntax).unwrap()),
2013 FLOAT_NUMBER => LiteralExprKind::FloatNumber(FloatNumber::cast(&self.syntax).unwrap()),
2014 TRUE_KW => LiteralExprKind::TrueKw(TrueKw::cast(&self.syntax).unwrap()),
2015 FALSE_KW => LiteralExprKind::FalseKw(FalseKw::cast(&self.syntax).unwrap()),
2016 _ => unreachable!(),
2017 }
2018 }
2019}
2020
2021impl LiteralExpr {}
2022 1661
2023// LiteralPat 1662// LiteralPat
2024#[derive(Debug, PartialEq, Eq, Hash)] 1663#[derive(Debug, PartialEq, Eq, Hash)]
@@ -3402,64 +3041,6 @@ impl ToOwned for RangePat {
3402 3041
3403impl RangePat {} 3042impl RangePat {}
3404 3043
3405// RawByteString
3406#[derive(Debug, PartialEq, Eq, Hash)]
3407#[repr(transparent)]
3408pub struct RawByteString {
3409 pub(crate) syntax: SyntaxNode,
3410}
3411unsafe impl TransparentNewType for RawByteString {
3412 type Repr = rowan::SyntaxNode<RaTypes>;
3413}
3414
3415impl AstNode for RawByteString {
3416 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3417 match syntax.kind() {
3418 RAW_BYTE_STRING => Some(RawByteString::from_repr(syntax.into_repr())),
3419 _ => None,
3420 }
3421 }
3422 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3423}
3424
3425impl ToOwned for RawByteString {
3426 type Owned = TreeArc<RawByteString>;
3427 fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) }
3428}
3429
3430
3431impl ast::AstToken for RawByteString {}
3432impl RawByteString {}
3433
3434// RawString
3435#[derive(Debug, PartialEq, Eq, Hash)]
3436#[repr(transparent)]
3437pub struct RawString {
3438 pub(crate) syntax: SyntaxNode,
3439}
3440unsafe impl TransparentNewType for RawString {
3441 type Repr = rowan::SyntaxNode<RaTypes>;
3442}
3443
3444impl AstNode for RawString {
3445 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3446 match syntax.kind() {
3447 RAW_STRING => Some(RawString::from_repr(syntax.into_repr())),
3448 _ => None,
3449 }
3450 }
3451 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3452}
3453
3454impl ToOwned for RawString {
3455 type Owned = TreeArc<RawString>;
3456 fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) }
3457}
3458
3459
3460impl ast::AstToken for RawString {}
3461impl RawString {}
3462
3463// RefExpr 3044// RefExpr
3464#[derive(Debug, PartialEq, Eq, Hash)] 3045#[derive(Debug, PartialEq, Eq, Hash)]
3465#[repr(transparent)] 3046#[repr(transparent)]
@@ -3620,34 +3201,6 @@ impl ReturnExpr {
3620 } 3201 }
3621} 3202}
3622 3203
3623// SelfKw
3624#[derive(Debug, PartialEq, Eq, Hash)]
3625#[repr(transparent)]
3626pub struct SelfKw {
3627 pub(crate) syntax: SyntaxNode,
3628}
3629unsafe impl TransparentNewType for SelfKw {
3630 type Repr = rowan::SyntaxNode<RaTypes>;
3631}
3632
3633impl AstNode for SelfKw {
3634 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3635 match syntax.kind() {
3636 SELF_KW => Some(SelfKw::from_repr(syntax.into_repr())),
3637 _ => None,
3638 }
3639 }
3640 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3641}
3642
3643impl ToOwned for SelfKw {
3644 type Owned = TreeArc<SelfKw>;
3645 fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) }
3646}
3647
3648
3649impl SelfKw {}
3650
3651// SelfParam 3204// SelfParam
3652#[derive(Debug, PartialEq, Eq, Hash)] 3205#[derive(Debug, PartialEq, Eq, Hash)]
3653#[repr(transparent)] 3206#[repr(transparent)]
@@ -3675,11 +3228,7 @@ impl ToOwned for SelfParam {
3675 3228
3676 3229
3677impl ast::TypeAscriptionOwner for SelfParam {} 3230impl ast::TypeAscriptionOwner for SelfParam {}
3678impl SelfParam { 3231impl SelfParam {}
3679 pub fn self_kw(&self) -> Option<&SelfKw> {
3680 super::child_opt(self)
3681 }
3682}
3683 3232
3684// SlicePat 3233// SlicePat
3685#[derive(Debug, PartialEq, Eq, Hash)] 3234#[derive(Debug, PartialEq, Eq, Hash)]
@@ -3864,35 +3413,6 @@ impl Stmt {
3864 3413
3865impl Stmt {} 3414impl Stmt {}
3866 3415
3867// String
3868#[derive(Debug, PartialEq, Eq, Hash)]
3869#[repr(transparent)]
3870pub struct String {
3871 pub(crate) syntax: SyntaxNode,
3872}
3873unsafe impl TransparentNewType for String {
3874 type Repr = rowan::SyntaxNode<RaTypes>;
3875}
3876
3877impl AstNode for String {
3878 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3879 match syntax.kind() {
3880 STRING => Some(String::from_repr(syntax.into_repr())),
3881 _ => None,
3882 }
3883 }
3884 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3885}
3886
3887impl ToOwned for String {
3888 type Owned = TreeArc<String>;
3889 fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) }
3890}
3891
3892
3893impl ast::AstToken for String {}
3894impl String {}
3895
3896// StructDef 3416// StructDef
3897#[derive(Debug, PartialEq, Eq, Hash)] 3417#[derive(Debug, PartialEq, Eq, Hash)]
3898#[repr(transparent)] 3418#[repr(transparent)]
@@ -4061,41 +3581,13 @@ impl ast::NameOwner for TraitDef {}
4061impl ast::AttrsOwner for TraitDef {} 3581impl ast::AttrsOwner for TraitDef {}
4062impl ast::DocCommentsOwner for TraitDef {} 3582impl ast::DocCommentsOwner for TraitDef {}
4063impl ast::TypeParamsOwner for TraitDef {} 3583impl ast::TypeParamsOwner for TraitDef {}
3584impl ast::TypeBoundsOwner for TraitDef {}
4064impl TraitDef { 3585impl TraitDef {
4065 pub fn item_list(&self) -> Option<&ItemList> { 3586 pub fn item_list(&self) -> Option<&ItemList> {
4066 super::child_opt(self) 3587 super::child_opt(self)
4067 } 3588 }
4068} 3589}
4069 3590
4070// TrueKw
4071#[derive(Debug, PartialEq, Eq, Hash)]
4072#[repr(transparent)]
4073pub struct TrueKw {
4074 pub(crate) syntax: SyntaxNode,
4075}
4076unsafe impl TransparentNewType for TrueKw {
4077 type Repr = rowan::SyntaxNode<RaTypes>;
4078}
4079
4080impl AstNode for TrueKw {
4081 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4082 match syntax.kind() {
4083 TRUE_KW => Some(TrueKw::from_repr(syntax.into_repr())),
4084 _ => None,
4085 }
4086 }
4087 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4088}
4089
4090impl ToOwned for TrueKw {
4091 type Owned = TreeArc<TrueKw>;
4092 fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) }
4093}
4094
4095
4096impl ast::AstToken for TrueKw {}
4097impl TrueKw {}
4098
4099// TryExpr 3591// TryExpr
4100#[derive(Debug, PartialEq, Eq, Hash)] 3592#[derive(Debug, PartialEq, Eq, Hash)]
4101#[repr(transparent)] 3593#[repr(transparent)]
@@ -4291,6 +3783,7 @@ impl ast::NameOwner for TypeAliasDef {}
4291impl ast::TypeParamsOwner for TypeAliasDef {} 3783impl ast::TypeParamsOwner for TypeAliasDef {}
4292impl ast::AttrsOwner for TypeAliasDef {} 3784impl ast::AttrsOwner for TypeAliasDef {}
4293impl ast::DocCommentsOwner for TypeAliasDef {} 3785impl ast::DocCommentsOwner for TypeAliasDef {}
3786impl ast::TypeBoundsOwner for TypeAliasDef {}
4294impl TypeAliasDef { 3787impl TypeAliasDef {
4295 pub fn type_ref(&self) -> Option<&TypeRef> { 3788 pub fn type_ref(&self) -> Option<&TypeRef> {
4296 super::child_opt(self) 3789 super::child_opt(self)
@@ -4369,6 +3862,70 @@ impl TypeArgList {
4369 } 3862 }
4370} 3863}
4371 3864
3865// TypeBound
3866#[derive(Debug, PartialEq, Eq, Hash)]
3867#[repr(transparent)]
3868pub struct TypeBound {
3869 pub(crate) syntax: SyntaxNode,
3870}
3871unsafe impl TransparentNewType for TypeBound {
3872 type Repr = rowan::SyntaxNode<RaTypes>;
3873}
3874
3875impl AstNode for TypeBound {
3876 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3877 match syntax.kind() {
3878 TYPE_BOUND => Some(TypeBound::from_repr(syntax.into_repr())),
3879 _ => None,
3880 }
3881 }
3882 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3883}
3884
3885impl ToOwned for TypeBound {
3886 type Owned = TreeArc<TypeBound>;
3887 fn to_owned(&self) -> TreeArc<TypeBound> { TreeArc::cast(self.syntax.to_owned()) }
3888}
3889
3890
3891impl TypeBound {
3892 pub fn type_ref(&self) -> Option<&TypeRef> {
3893 super::child_opt(self)
3894 }
3895}
3896
3897// TypeBoundList
3898#[derive(Debug, PartialEq, Eq, Hash)]
3899#[repr(transparent)]
3900pub struct TypeBoundList {
3901 pub(crate) syntax: SyntaxNode,
3902}
3903unsafe impl TransparentNewType for TypeBoundList {
3904 type Repr = rowan::SyntaxNode<RaTypes>;
3905}
3906
3907impl AstNode for TypeBoundList {
3908 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3909 match syntax.kind() {
3910 TYPE_BOUND_LIST => Some(TypeBoundList::from_repr(syntax.into_repr())),
3911 _ => None,
3912 }
3913 }
3914 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3915}
3916
3917impl ToOwned for TypeBoundList {
3918 type Owned = TreeArc<TypeBoundList>;
3919 fn to_owned(&self) -> TreeArc<TypeBoundList> { TreeArc::cast(self.syntax.to_owned()) }
3920}
3921
3922
3923impl TypeBoundList {
3924 pub fn bounds(&self) -> impl Iterator<Item = &TypeBound> {
3925 super::children(self)
3926 }
3927}
3928
4372// TypeParam 3929// TypeParam
4373#[derive(Debug, PartialEq, Eq, Hash)] 3930#[derive(Debug, PartialEq, Eq, Hash)]
4374#[repr(transparent)] 3931#[repr(transparent)]
@@ -4397,6 +3954,7 @@ impl ToOwned for TypeParam {
4397 3954
4398impl ast::NameOwner for TypeParam {} 3955impl ast::NameOwner for TypeParam {}
4399impl ast::AttrsOwner for TypeParam {} 3956impl ast::AttrsOwner for TypeParam {}
3957impl ast::TypeBoundsOwner for TypeParam {}
4400impl TypeParam {} 3958impl TypeParam {}
4401 3959
4402// TypeParamList 3960// TypeParamList
@@ -4737,7 +4295,44 @@ impl ToOwned for WhereClause {
4737} 4295}
4738 4296
4739 4297
4740impl WhereClause {} 4298impl WhereClause {
4299 pub fn predicates(&self) -> impl Iterator<Item = &WherePred> {
4300 super::children(self)
4301 }
4302}
4303
4304// WherePred
4305#[derive(Debug, PartialEq, Eq, Hash)]
4306#[repr(transparent)]
4307pub struct WherePred {
4308 pub(crate) syntax: SyntaxNode,
4309}
4310unsafe impl TransparentNewType for WherePred {
4311 type Repr = rowan::SyntaxNode<RaTypes>;
4312}
4313
4314impl AstNode for WherePred {
4315 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4316 match syntax.kind() {
4317 WHERE_PRED => Some(WherePred::from_repr(syntax.into_repr())),
4318 _ => None,
4319 }
4320 }
4321 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4322}
4323
4324impl ToOwned for WherePred {
4325 type Owned = TreeArc<WherePred>;
4326 fn to_owned(&self) -> TreeArc<WherePred> { TreeArc::cast(self.syntax.to_owned()) }
4327}
4328
4329
4330impl ast::TypeBoundsOwner for WherePred {}
4331impl WherePred {
4332 pub fn type_ref(&self) -> Option<&TypeRef> {
4333 super::child_opt(self)
4334 }
4335}
4741 4336
4742// WhileExpr 4337// WhileExpr
4743#[derive(Debug, PartialEq, Eq, Hash)] 4338#[derive(Debug, PartialEq, Eq, Hash)]