Enum Lit

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: 1 or 1u16.

Float(LitFloat)

A floating point literal: 1f64 or 1.0e10f64.

Must be finite. May not be infinite or NaN.

Bool(LitBool)

A boolean literal: true or false.

Verbatim(proc_macro2::Literal)

A raw token literal not interpreted by Syn.

Implementations

impl Lit

fn new(token: Literal) -> Self

Interpret a Syn literal from a proc-macro2 literal.

fn suffix(self: &Self) -> &str
fn span(self: &Self) -> Span
fn set_span(self: &mut Self, span: Span)

impl Clone for Lit

fn clone(self: &Self) -> Self

impl Debug for Lit

fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result

impl Eq for Lit

impl Freeze for Lit

impl From for Lit

fn from(e: LitCStr) -> Lit

impl From for Lit

fn from(e: LitBool) -> Lit

impl From for Lit

fn from(e: LitChar) -> Lit

impl From for Lit

fn from(e: LitByteStr) -> Lit

impl From for Lit

fn from(e: LitFloat) -> Lit

impl From for Lit

fn from(e: LitByte) -> Lit

impl From for Lit

fn from(e: LitStr) -> Lit

impl From for Lit

fn from(e: LitInt) -> Lit

impl Hash for Lit

fn hash<H>(self: &Self, state: &mut H)
where
    H: Hasher

impl Parse for Lit

fn parse(input: ParseStream<'_>) -> Result<Self>

impl PartialEq for Lit

fn eq(self: &Self, other: &Self) -> bool

impl RefUnwindSafe for Lit

impl Send for Lit

impl Sync for Lit

impl ToTokens for Lit

fn to_tokens(self: &Self, tokens: &mut TokenStream)

impl Token for Lit

impl Unpin for Lit

impl UnsafeUnpin for Lit

impl UnwindSafe for Lit

impl<T> Any for Lit

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Lit

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Lit

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Lit

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Lit

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Lit

fn span(self: &Self) -> Span

impl<T> ToOwned for Lit

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Lit

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Lit

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Lit

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>