Enum Lit
#[non_exhaustive]
pub enum Lit
A Rust literal such as a string or integer or boolean.
Syntax tree enum
This type is a syntax tree enum.
Variants
-
Str(LitStr) A UTF-8 string literal:
"foo".-
ByteStr(LitByteStr) A byte string literal:
b"foo".-
CStr(LitCStr) A nul-terminated C-string literal:
c"foo".-
Byte(LitByte) A byte literal:
b'f'.-
Char(LitChar) A character literal:
'a'.-
Int(LitInt) An integer literal:
1or1u16.-
Float(LitFloat) A floating point literal:
1f64or1.0e10f64.Must be finite. May not be infinite or NaN.
-
Bool(LitBool) A boolean literal:
trueorfalse.-
Verbatim(Literal) A raw token literal not interpreted by Syn.
Implementations
impl Lit
fn new(token: Literal) -> SelfInterpret a Syn literal from a proc-macro2 literal.
fn suffix(&self) -> &strfn span(&self) -> Spanfn set_span(&mut self, span: Span)
Trait Implementations
impl Clone for Lit
fn clone(&self) -> Self
impl Parse for Lit
fn parse(input: ParseStream<'_>) -> Result<Self>
impl ToTokens for Lit
fn to_tokens(&self, tokens: &mut TokenStream)
impl Token for Lit
Auto Trait Implementations
impl !Send for Lit
impl !Sync for Lit
impl Freeze for Lit
impl RefUnwindSafe for Lit
impl Unpin for Lit
impl UnsafeUnpin for Lit
impl UnwindSafe for Lit
Blanket Implementations
impl<T> Any for Lit
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Lit
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Lit
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Lit
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Lit
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Spanned for Lit
where
T: Spanned + ?Sized,
fn span(&self) -> Span
impl<T> ToOwned for Lit
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Lit
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Lit
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Lit
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>