pub enum Value {
True,
False,
Int(IntType),
Float(FloatType),
String(String),
Symbol(String),
List(List),
NativeFunc(fn(env: Rc<RefCell<Env>>, args: &Vec<Value>) -> Result<Value, RuntimeError>),
Lambda(Lambda),
TailCall {
func: Rc<Value>,
args: Vec<Value>,
},
}
Expand description
Value
encompasses all possible Lisp values, including atoms, lists, and
others.
Variants
True
False
Int(IntType)
Float(FloatType)
String(String)
Symbol(String)
List(List)
NativeFunc(fn(env: Rc<RefCell<Env>>, args: &Vec<Value>) -> Result<Value, RuntimeError>)
Lambda(Lambda)
TailCall
Implementations
sourceimpl Value
impl Value
pub const NIL: Value
pub fn type_name(&self) -> &str
pub fn from_truth(b: bool) -> Value
pub fn is_truthy(&self) -> bool
pub fn from_int<I: Into<IntType>>(i: I) -> Value
pub fn from_float<F: Into<FloatType>>(f: F) -> Value
pub fn as_int(&self) -> Option<IntType>
pub fn as_float(&self) -> Option<FloatType>
pub fn as_string(&self) -> Option<&str>
pub fn as_list(&self) -> Option<List>
pub fn as_lambda(&self) -> Option<Lambda>
pub fn as_symbol(&self) -> Option<String>
Trait Implementations
sourceimpl<'a> FromIterator<&'a Value> for List
impl<'a> FromIterator<&'a Value> for List
sourcefn from_iter<I: IntoIterator<Item = &'a Value>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = &'a Value>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl FromIterator<Value> for List
impl FromIterator<Value> for List
sourcefn from_iter<I: IntoIterator<Item = Value>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Value>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl Ord for Value
impl Ord for Value
sourceimpl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
sourcefn partial_cmp(&self, other: &Value) -> Option<Ordering>
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Value
Auto Trait Implementations
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more