pub enum LitNumber {
Int(LitInt),
Float(LitFloat),
}
Expand description
An integer or fixed-point number literal: 1
or 1.0
.
Variants§
Implementations§
Source§impl LitNumber
impl LitNumber
pub fn new_int(repr: &str, span: Span) -> Self
pub fn new_fixed(repr: &str, span: Span) -> Self
pub fn peek(lookahead: &Lookahead1<'_>) -> bool
Sourcepub fn base10_digits(&self) -> &str
pub fn base10_digits(&self) -> &str
Returns the base-10 digits of the literal.
Sourcepub fn base10_parse<N>(&self) -> Result<N>
pub fn base10_parse<N>(&self) -> Result<N>
Parses the literal into a selected number type.
This is equivalent to lit.base10_digits().parse()
except that the
resulting errors will be correctly spanned to point to the literal token
in the macro input.
pub fn suffix(&self) -> &str
pub fn token(&self) -> Literal
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LitNumber
impl RefUnwindSafe for LitNumber
impl !Send for LitNumber
impl !Sync for LitNumber
impl Unpin for LitNumber
impl UnwindSafe for LitNumber
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)