pub enum Literal<'src> {
String(&'src str),
Number(f64),
Bool(bool),
Null,
}
Expand description
A literal type
Variants§
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§
impl<'src> Copy for Literal<'src>
impl<'src> StructuralPartialEq for Literal<'src>
Auto Trait Implementations§
impl<'src> Freeze for Literal<'src>
impl<'src> RefUnwindSafe for Literal<'src>
impl<'src> Send for Literal<'src>
impl<'src> Sync for Literal<'src>
impl<'src> Unpin for Literal<'src>
impl<'src> UnwindSafe for Literal<'src>
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