Type Alias OwnedLiteral

Source
pub type OwnedLiteral = Literal<String>;
Expand description

A literal which owns the underlying buffer.

Aliased Type§

enum OwnedLiteral {
    Bool(BoolLit),
    Integer(IntegerLit<String>),
    Float(FloatLit<String>),
    Char(CharLit<String>),
    String(StringLit<String>),
    Byte(ByteLit<String>),
    ByteString(ByteStringLit<String>),
}

Variants§

Implementations

Source§

impl<B: Buffer> Literal<B>

Source

pub fn parse(input: B) -> Result<Self, ParseError>

Parses the given input as a Rust literal.

Trait Implementations

Source§

impl<B: Clone + Buffer> Clone for Literal<B>

Source§

fn clone(&self) -> Literal<B>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + Buffer> Debug for Literal<B>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<B: Buffer> Display for Literal<B>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&Literal> for Literal<String>

Source§

fn from(src: &Literal) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<BoolLit> for Literal<B>

Source§

fn from(src: BoolLit) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<ByteLit<B>> for Literal<B>

Source§

fn from(src: ByteLit<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<ByteStringLit<B>> for Literal<B>

Source§

fn from(src: ByteStringLit<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<CharLit<B>> for Literal<B>

Source§

fn from(src: CharLit<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<FloatLit<B>> for Literal<B>

Source§

fn from(src: FloatLit<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<IntegerLit<B>> for Literal<B>

Source§

fn from(src: IntegerLit<B>) -> Self

Converts to this type from the input type.
Source§

impl From<Literal> for Literal<String>

Source§

fn from(src: Literal) -> Self

Converts to this type from the input type.
Source§

impl<B: Buffer> From<StringLit<B>> for Literal<B>

Source§

fn from(src: StringLit<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: PartialEq + Buffer> PartialEq for Literal<B>

Source§

fn eq(&self, other: &Literal<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&TokenTree> for Literal<String>

Source§

type Error = InvalidToken

The type returned in the event of a conversion error.
Source§

fn try_from(tt: &TokenTree) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<TokenTree> for Literal<String>

Source§

type Error = InvalidToken

The type returned in the event of a conversion error.
Source§

fn try_from(tt: TokenTree) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<B: Eq + Buffer> Eq for Literal<B>

Source§

impl<B: Buffer> StructuralPartialEq for Literal<B>