pub enum Literal<'a> {
Number(f64),
String(&'a str),
Concat(Box<Literal<'a>>, Box<Literal<'a>>),
True,
False,
Nil,
Void,
List(Vec<Literal<'a>>),
}Expand description
A literal value
Variants§
Number(f64)
A number
String(&'a str)
A string
Concat(Box<Literal<'a>>, Box<Literal<'a>>)
Concatenated strings
True
Boolean true
False
Boolean false
Nil
NULL
Void
A void return
List(Vec<Literal<'a>>)
A list of expressions
Implementations§
Source§impl<'a> Literal<'a>
impl<'a> Literal<'a>
Sourcepub fn uint(&self) -> Result<usize, RuntimeError>
pub fn uint(&self) -> Result<usize, RuntimeError>
Returns the inner literal if it’s a proper unsigned integer truly, asserting a runtime error if not
Sourcepub fn number(&self) -> Result<f64, RuntimeError>
pub fn number(&self) -> Result<f64, RuntimeError>
Returns the inner literal if it’s numeric, asserting a runtime error if not
Sourcepub fn bool(&self) -> Result<bool, RuntimeError>
pub fn bool(&self) -> Result<bool, RuntimeError>
Returns the inner literal if it’s boolean, asserting a runtime error if not
Sourcepub fn equals(&self, other: &Self) -> Result<Literal<'a>, RuntimeError>
pub fn equals(&self, other: &Self) -> Result<Literal<'a>, RuntimeError>
Returns the True literal if the two literals are losely equal
Sourcepub fn not_equals(&self, other: &Self) -> Result<Literal<'a>, RuntimeError>
pub fn not_equals(&self, other: &Self) -> Result<Literal<'a>, RuntimeError>
Returns the True literal if the two literals are not losely equal
Trait Implementations§
Source§impl<'a> PartialEq for Literal<'a>
impl<'a> PartialEq for Literal<'a>
impl<'a> StructuralPartialEq for Literal<'a>
Auto Trait Implementations§
impl<'a> Freeze for Literal<'a>
impl<'a> RefUnwindSafe for Literal<'a>
impl<'a> Send for Literal<'a>
impl<'a> Sync for Literal<'a>
impl<'a> Unpin for Literal<'a>
impl<'a> UnsafeUnpin for Literal<'a>
impl<'a> UnwindSafe for Literal<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more