diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-15 22:51:55 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-15 23:11:20 +0100 |
| commit | b6202b646a0d5ecced301d9bac8bfcaf977d7ee4 (patch) | |
| tree | 7d42cb50f9e66153e7e8b2217009684e25f54f42 /src/syntax/ast.rs | |
| parent | f3980c704544a464f9729cc8bc9f97d3a7454769 (diff) | |
Reflection for castables
Diffstat (limited to 'src/syntax/ast.rs')
| -rw-r--r-- | src/syntax/ast.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 77c788d3..56d4415e 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -1577,12 +1577,17 @@ impl Ident { _ => panic!("identifier is of wrong kind"), } } + + /// Get the identifier as a string slice. + pub fn as_str(&self) -> &str { + self.get() + } } impl Deref for Ident { type Target = str; fn deref(&self) -> &Self::Target { - self.get() + self.as_str() } } |
