Enum litrs::Literal [−][src]
pub enum Literal<B: Buffer> { Bool(BoolLit), Integer(IntegerLit<B>), Float(FloatLit<B>), Char(CharLit<B>), String(StringLit<B>), Byte(ByteLit<B>), ByteString(ByteStringLit<B>), }
Expand description
A literal. This is the main type of this library.
This type is generic over the underlying buffer B
, which can be &str
or
String
. There are two useful type aliases: OwnedLiteral
and
SharedLiteral
.
To create this type, you have to either call Literal::parse
with an
input string or use the From<_>
impls of this type. The impls are only
available of the corresponding crate features are enabled (they are enabled
by default).
Variants
Bool(BoolLit)
Integer(IntegerLit<B>)
Float(FloatLit<B>)
Char(CharLit<B>)
String(StringLit<B>)
Byte(ByteLit<B>)
ByteString(ByteStringLit<B>)
Implementations
Parses the given input as a Rust literal.
Makes a copy of the underlying buffer and returns the owned version of
Self
.
Trait Implementations
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl<B> RefUnwindSafe for Literal<B> where
B: RefUnwindSafe,
impl<B> UnwindSafe for Literal<B> where
B: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more