pub struct TerminalLiteralNumber<'db> { /* private fields */ }Implementations§
Source§impl<'a> TerminalLiteralNumber<'a>
impl<'a> TerminalLiteralNumber<'a>
Sourcepub fn numeric_value_and_suffix(
&self,
db: &'a dyn Database,
) -> (BigInt, Option<SmolStrId<'a>>)
pub fn numeric_value_and_suffix( &self, db: &'a dyn Database, ) -> (BigInt, Option<SmolStrId<'a>>)
Interpret this terminal as a BigInt number and get the suffix if this literal has one.
Splits at _ boundaries from right to left, returning the longest prefix that parses as a
valid number in the appropriate radix, with the remainder (after the _) as the suffix.
This handles ambiguity for radices where suffix chars are valid digits — e.g., 0x1_f32
parses as hex 0x1F32 (no suffix) because "1_f32" is a valid hex number, while
1_f32 in decimal returns value 1 with suffix "f32". Also handles compound suffixes
like 1_u32_u8: returns value 1 with suffix "u32_u8".
Returns (BigInt::ZERO, Some(full_token_text)) as a sentinel for malformed literals where
no prefix parses (e.g., 0x_u32 where the hex body is empty). Callers treat Some suffix
as an error indicator.
Source§impl<'db> TerminalLiteralNumber<'db>
impl<'db> TerminalLiteralNumber<'db>
pub fn leading_trivia(&self, db: &'db dyn Database) -> Trivia<'db>
pub fn token(&self, db: &'db dyn Database) -> TokenLiteralNumber<'db>
pub fn trailing_trivia(&self, db: &'db dyn Database) -> Trivia<'db>
Trait Implementations§
Source§impl<'db> Clone for TerminalLiteralNumber<'db>
impl<'db> Clone for TerminalLiteralNumber<'db>
Source§fn clone(&self) -> TerminalLiteralNumber<'db>
fn clone(&self) -> TerminalLiteralNumber<'db>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'db> Debug for TerminalLiteralNumber<'db>
impl<'db> Debug for TerminalLiteralNumber<'db>
impl<'db> Eq for TerminalLiteralNumber<'db>
Source§impl<'db> Hash for TerminalLiteralNumber<'db>
impl<'db> Hash for TerminalLiteralNumber<'db>
Source§impl<'db> PartialEq for TerminalLiteralNumber<'db>
impl<'db> PartialEq for TerminalLiteralNumber<'db>
Source§fn eq(&self, other: &TerminalLiteralNumber<'db>) -> bool
fn eq(&self, other: &TerminalLiteralNumber<'db>) -> bool
self and other values to be equal, and is used by ==.impl<'db> StructuralPartialEq for TerminalLiteralNumber<'db>
Source§impl<'db> Terminal<'db> for TerminalLiteralNumber<'db>
impl<'db> Terminal<'db> for TerminalLiteralNumber<'db>
const KIND: SyntaxKind = SyntaxKind::TerminalLiteralNumber
type TokenType = TokenLiteralNumber<'db>
fn new_green( db: &'db dyn Database, leading_trivia: TriviaGreen<'db>, token: <<TerminalLiteralNumber<'db> as Terminal<'db>>::TokenType as TypedSyntaxNode<'db>>::Green, trailing_trivia: TriviaGreen<'db>, ) -> Self::Green
Source§fn text(&self, db: &'db dyn Database) -> SmolStrId<'db>
fn text(&self, db: &'db dyn Database) -> SmolStrId<'db>
Source§fn cast_token(db: &'a dyn Database, node: SyntaxNode<'a>) -> Option<Self>
fn cast_token(db: &'a dyn Database, node: SyntaxNode<'a>) -> Option<Self>
Source§impl<'db> TypedSyntaxNode<'db> for TerminalLiteralNumber<'db>
impl<'db> TypedSyntaxNode<'db> for TerminalLiteralNumber<'db>
Source§const OPTIONAL_KIND: Option<SyntaxKind>
const OPTIONAL_KIND: Option<SyntaxKind>
type StablePtr = TerminalLiteralNumberPtr<'db>
type Green = TerminalLiteralNumberGreen<'db>
fn missing(db: &'db dyn Database) -> Self::Green
fn from_syntax_node(db: &'db dyn Database, node: SyntaxNode<'db>) -> Self
fn cast(db: &'db dyn Database, node: SyntaxNode<'db>) -> Option<Self>
fn as_syntax_node(&self) -> SyntaxNode<'db>
fn stable_ptr(&self, db: &'db dyn Database) -> Self::StablePtr
Source§impl<'db> Update for TerminalLiteralNumber<'db>
impl<'db> Update for TerminalLiteralNumber<'db>
Auto Trait Implementations§
impl<'db> Freeze for TerminalLiteralNumber<'db>
impl<'db> RefUnwindSafe for TerminalLiteralNumber<'db>
impl<'db> Send for TerminalLiteralNumber<'db>
impl<'db> Sync for TerminalLiteralNumber<'db>
impl<'db> Unpin for TerminalLiteralNumber<'db>
impl<'db> UnsafeUnpin for TerminalLiteralNumber<'db>
impl<'db> UnwindSafe for TerminalLiteralNumber<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> HashEqLike<&T> for T
impl<T> HashEqLike<&T> for T
Source§impl<T> HashEqLike<Cow<'_, T>> for T
impl<T> HashEqLike<Cow<'_, T>> for T
Source§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more