diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 5b5f71ee7..2e9ae263a 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -3236,6 +3236,43 @@ impl<'a> AstNode<'a> for Stmt<'a> { | |||
3236 | 3236 | ||
3237 | impl<'a> Stmt<'a> {} | 3237 | impl<'a> Stmt<'a> {} |
3238 | 3238 | ||
3239 | // String | ||
3240 | #[derive(Debug, Clone, Copy,)] | ||
3241 | pub struct StringNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
3242 | pub(crate) syntax: SyntaxNode<R>, | ||
3243 | } | ||
3244 | pub type String<'a> = StringNode<RefRoot<'a>>; | ||
3245 | |||
3246 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StringNode<R1>> for StringNode<R2> { | ||
3247 | fn eq(&self, other: &StringNode<R1>) -> bool { self.syntax == other.syntax } | ||
3248 | } | ||
3249 | impl<R: TreeRoot<RaTypes>> Eq for StringNode<R> {} | ||
3250 | impl<R: TreeRoot<RaTypes>> Hash for StringNode<R> { | ||
3251 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3252 | } | ||
3253 | |||
3254 | impl<'a> AstNode<'a> for String<'a> { | ||
3255 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
3256 | match syntax.kind() { | ||
3257 | STRING => Some(String { syntax }), | ||
3258 | _ => None, | ||
3259 | } | ||
3260 | } | ||
3261 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
3262 | } | ||
3263 | |||
3264 | impl<R: TreeRoot<RaTypes>> StringNode<R> { | ||
3265 | pub fn borrowed(&self) -> String { | ||
3266 | StringNode { syntax: self.syntax.borrowed() } | ||
3267 | } | ||
3268 | pub fn owned(&self) -> StringNode { | ||
3269 | StringNode { syntax: self.syntax.owned() } | ||
3270 | } | ||
3271 | } | ||
3272 | |||
3273 | |||
3274 | impl<'a> String<'a> {} | ||
3275 | |||
3239 | // StructDef | 3276 | // StructDef |
3240 | #[derive(Debug, Clone, Copy,)] | 3277 | #[derive(Debug, Clone, Copy,)] |
3241 | pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3278 | pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |