Enum rune::ast::Lit [−][src]
A literal value
Variants
Bool(LitBool)
A boolean literal
Byte(LitByte)
A byte literal
Str(LitStr)
A string literal
ByteStr(LitByteStr)
A byte string literal
Char(LitChar)
A character literal
Number(LitNumber)
A number literal
Implementations
impl Lit
[src]
pub fn new<T>(lit: T) -> Self where
T: IntoLit,
[src]
T: IntoLit,
pub fn new_with<T>(lit: T, span: Span, storage: &Storage) -> Self where
T: IntoLit,
[src]
T: IntoLit,
Construct a new literal with the specified span and storage.
This does not panic outside of a macro context, but requires access to the specified arguments.
Examples
use rune::{ast, Storage}; use runestick::Span; let storage = Storage::default(); let string = ast::Lit::new_with("hello world", Span::empty(), &storage);
Trait Implementations
impl Clone for Lit
[src]
impl Debug for Lit
[src]
impl Eq for Lit
[src]
impl Parse for Lit
[src]
Parsing a Lit
Examples
use rune::{testing, ast}; testing::roundtrip::<ast::Lit>("true"); testing::roundtrip::<ast::Lit>("false"); testing::roundtrip::<ast::Lit>("'🔥'"); testing::roundtrip::<ast::Lit>("b'4'"); testing::roundtrip::<ast::Lit>("b\"bytes\""); testing::roundtrip::<ast::Lit>("1.2"); testing::roundtrip::<ast::Lit>("42"); testing::roundtrip::<ast::Lit>("\"mary had a little lamb\"");
fn parse(p: &mut Parser<'_>) -> Result<Self, ParseError>
[src]
impl PartialEq<Lit> for Lit
[src]
impl Spanned for Lit
[src]
impl StructuralEq for Lit
[src]
impl StructuralPartialEq for Lit
[src]
impl ToTokens for Lit
[src]
fn to_tokens(&self, context: &MacroContext, stream: &mut TokenStream)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Lit
impl Send for Lit
impl Sync for Lit
impl Unpin for Lit
impl UnwindSafe for Lit
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,