Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/token_text.rs')
| -rw-r--r-- | crates/syntax/src/token_text.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/syntax/src/token_text.rs b/crates/syntax/src/token_text.rs index 913b24d42b..09c080c0c2 100644 --- a/crates/syntax/src/token_text.rs +++ b/crates/syntax/src/token_text.rs @@ -3,6 +3,7 @@ use std::{cmp::Ordering, fmt, ops}; use rowan::GreenToken; +use smol_str::SmolStr; pub struct TokenText<'a>(pub(crate) Repr<'a>); @@ -47,6 +48,12 @@ impl From<TokenText<'_>> for String { } } +impl From<TokenText<'_>> for SmolStr { + fn from(token_text: TokenText<'_>) -> Self { + SmolStr::new(token_text.as_str()) + } +} + impl PartialEq<&'_ str> for TokenText<'_> { fn eq(&self, other: &&str) -> bool { self.as_str() == *other |