pub enum Value {
Number(f64),
Fraction(Ratio<BigInt>),
String(String),
Boolean(bool),
Null,
Array(Vec<Value>),
Dict(HashMap<String, Value>),
Function {
params: Vec<String>,
body: Vec<Stmt>,
env: Rc<RefCell<Environment>>,
},
Generator {
params: Vec<String>,
body: Vec<Stmt>,
env: Rc<RefCell<Environment>>,
state: GeneratorState,
},
Lazy {
expr: Expr,
env: Rc<RefCell<Environment>>,
cached: Option<Box<Value>>,
},
BuiltIn {
name: String,
arity: usize,
},
}Expand description
Runtime value types
Variants§
Number(f64)
Numeric value (f64)
Fraction(Ratio<BigInt>)
Rational number (exact fraction)
String(String)
String value
Boolean(bool)
Boolean value
Null
Null value
Array(Vec<Value>)
Array of values
Dict(HashMap<String, Value>)
Dictionary (key-value map)
Function
Function (closure)
Generator
Generator (lazy iterator)
Lazy
Lazy value (computed on demand)
BuiltIn
Built-in function
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Value
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
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