Type Alias SharedLiteral

Source
pub type SharedLiteral<'a> = Literal<&'a str>;
Expand description

A literal whose underlying buffer is borrowed.

Aliased Type§

enum SharedLiteral<'a> {
    Bool(BoolLit),
    Integer(IntegerLit<&'a str>),
    Float(FloatLit<&'a str>),
    Char(CharLit<&'a str>),
    String(StringLit<&'a str>),
    Byte(ByteLit<&'a str>),
    ByteString(ByteStringLit<&'a str>),
}

Variants§

§

Bool(BoolLit)

§

Integer(IntegerLit<&'a str>)

§

Float(FloatLit<&'a str>)

§

Char(CharLit<&'a str>)

§

String(StringLit<&'a str>)

§

Byte(ByteLit<&'a str>)

§

ByteString(ByteStringLit<&'a str>)

Implementations

Source§

impl Literal<&str>

Source

pub fn into_owned(self) -> OwnedLiteral

Makes a copy of the underlying buffer and returns the owned version of Self.

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<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<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<B: Eq + Buffer> Eq for Literal<B>

Source§

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