Trait LiteralExt

Source
pub trait LiteralExt:
    ProcMacroExt<LiteralExt = Self>
    + Literal
    + From<LiteralValue<Self::Span>>
    + From<StringLiteral<Self::Span>>
    + From<ByteStringLiteral<Self::Span>>
    + From<CharacterLiteral<Self::Span>>
    + From<ByteCharacterLiteral<Self::Span>>
    + From<IntLiteral<Self::Span>>
    + From<FloatLiteral<Self::Span>>
    + From<I8Literal<Self::Span>>
    + From<I16Literal<Self::Span>>
    + From<I32Literal<Self::Span>>
    + From<I64Literal<Self::Span>>
    + From<I128Literal<Self::Span>>
    + From<IsizeLiteral<Self::Span>>
    + From<U8Literal<Self::Span>>
    + From<U16Literal<Self::Span>>
    + From<U32Literal<Self::Span>>
    + From<U64Literal<Self::Span>>
    + From<U128Literal<Self::Span>>
    + From<UsizeLiteral<Self::Span>>
    + From<F32Literal<Self::Span>>
    + From<F64Literal<Self::Span>>
    + Into<LiteralValue<Self::Span>>
    + TryInto<StringLiteral<Self::Span>>
    + TryInto<ByteStringLiteral<Self::Span>>
    + TryInto<CharacterLiteral<Self::Span>>
    + TryInto<ByteCharacterLiteral<Self::Span>>
    + TryInto<IntLiteral<Self::Span>>
    + TryInto<FloatLiteral<Self::Span>>
    + TryInto<I8Literal<Self::Span>>
    + TryInto<I16Literal<Self::Span>>
    + TryInto<I32Literal<Self::Span>>
    + TryInto<I64Literal<Self::Span>>
    + TryInto<I128Literal<Self::Span>>
    + TryInto<IsizeLiteral<Self::Span>>
    + TryInto<U8Literal<Self::Span>>
    + TryInto<U16Literal<Self::Span>>
    + TryInto<U32Literal<Self::Span>>
    + TryInto<U64Literal<Self::Span>>
    + TryInto<U128Literal<Self::Span>>
    + TryInto<UsizeLiteral<Self::Span>>
    + TryInto<F32Literal<Self::Span>>
    + TryInto<F64Literal<Self::Span>>
    + Parse<Self::TokenTree>
    + IntoTokens<Self::TokenTree>
    + ToTokens<Self::TokenTree>
    + ToTokenStream<Self::TokenStream> {
    // Required method
    fn to_value(&self) -> LiteralValue<Self::Span>;
}
Expand description

Extensions for Literal.

This trait is implemented for Literal in proc_macro and proc_macro2 if the corresponding feature is enabled.

Required Methods§

Source

fn to_value(&self) -> LiteralValue<Self::Span>

Convert this Literal to a LiteralValue.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl LiteralExt for Literal

Available on crate feature proc-macro only.
Source§

fn to_value(&self) -> LiteralValue<Span>

Available on crate feature literal-value only.
Source§

impl LiteralExt for Literal

Available on crate feature proc-macro2 only.
Source§

fn to_value(&self) -> LiteralValue<Span>

Available on crate feature literal-value only.

Implementors§