pub enum Val {
Invalid,
Nil,
Bool(bool),
Number(f64),
String(RcStr),
List(Rc<List>),
Func(Func),
GenObj(GenObjPtr),
}
Variants§
Invalid
E.g. to check for usage before assignment
Nil
Bool(bool)
Number(f64)
String(RcStr)
Use of RcStr over Rc
List(Rc<List>)
Func(Func)
GenObj(GenObjPtr)
Implementations§
Source§impl Val
impl Val
pub fn truthy(&self) -> bool
pub fn number(&self) -> Option<f64>
pub fn expect_number(&self) -> Result<f64, Val>
pub fn list(&self) -> Option<&List>
pub fn expect_list(&self) -> Result<&List, Val>
pub fn func(&self) -> Option<&Rc<Code>>
pub fn expect_func(&self) -> Result<&Rc<Code>, Val>
pub fn genobj(&self) -> Option<&GenObjPtr>
pub fn expect_genobj(&self) -> Result<&GenObjPtr, Val>
pub fn lt(&self, other: &Self) -> Result<bool, Val>
Trait Implementations§
impl StructuralPartialEq for Val
Auto Trait Implementations§
impl Freeze for Val
impl !RefUnwindSafe for Val
impl !Send for Val
impl !Sync for Val
impl Unpin for Val
impl !UnwindSafe for Val
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