Enum ketos::value::Value
[−]
[src]
pub enum Value { Unit, Unbound, Bool(bool), Float(f64), Integer(Integer), Ratio(Ratio), Struct(Rc<Struct>), StructDef(Rc<StructDef>), Name(Name), Keyword(Name), Char(char), String(String), Quasiquote(Box<Value>, u32), Comma(Box<Value>, u32), CommaAt(Box<Value>, u32), Quote(Box<Value>, u32), List(RcVec<Value>), Function(Function), Lambda(Lambda), Foreign(Rc<ForeignValue>), }
Represents a value.
Variants
Unit
()
Unbound
Placeholder for missing optional values; should not be used to represent any real value.
Bool(bool)
Boolean -- true
or false
Float(f64)
Floating point number
Integer(Integer)
Signed arbitrary precision integer
Ratio(Ratio)
Arbitrary precision ratio
Struct(Rc<Struct>)
Struct value
StructDef(Rc<StructDef>)
Struct definition
Name(Name)
Literal name
Keyword(Name)
Keyword
Char(char)
Character
String(String)
String
Quasiquote(Box<Value>, u32)
Quasiquoted value; quote depth MUST NEVER be zero.
Comma(Box<Value>, u32)
Comma'd value; comma depth MUST NEVER be zero.
CommaAt(Box<Value>, u32)
Comma-at'd value; quote depth MUST NEVER be zero.
Quote(Box<Value>, u32)
Quoted value; quote depth MUST NEVER be zero.
List(RcVec<Value>)
Series of one or more values.
MUST NEVER be of length zero. Use Unit
to represent empty lists.
Function(Function)
Function implemented in Rust
Lambda(Lambda)
Compiled bytecode function
Foreign(Rc<ForeignValue>)
Boxed value of a foreign type
Methods
impl Value
[src]
fn new_foreign<T: ForeignValue>(t: T) -> Value
Returns a value of a foreign type.
fn new_foreign_fn<F>(name: Name, f: F) -> Value where F: Any + Fn(&Context, &mut [Value]) -> Result<Value, Error>
Returns a value containing a foreign function.
fn compare(&self, rhs: &Value) -> Result<Ordering, ExecError>
Compares two values; returns an error if the values cannot be compared.
fn is_equal(&self, rhs: &Value) -> Result<bool, ExecError>
Tests two values for equality; returns an error if the values cannot be compared.
fn is_identical(&self, rhs: &Value) -> bool
Returns whether this value is identical to another.
The notable difference between this and eq
is that float NaN
values
will compare equal.
fn take(&mut self) -> Value
Replaces the value with Unit
and returns the old value.
fn quasiquote(self, n: u32) -> Value
Returns the value, quasi-quoted.
fn comma(self, n: u32) -> Value
Returns the value, comma'd.
fn comma_at(self, n: u32) -> Value
Returns the value, comma-at'd.
fn quote(self, n: u32) -> Value
Returns the value, quoted.
fn type_name(&self) -> &'static str
Returns a string describing the type of the value.
Trait Implementations
impl Debug for Value
[src]
impl Clone for Value
[src]
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl NameDebug for Value
[src]
fn fmt(&self, names: &NameStore, f: &mut Formatter) -> Result
Writes the value's debug representation to the formatter stream.
impl NameDisplay for Value
[src]
fn fmt(&self, names: &NameStore, f: &mut Formatter) -> Result
Writes the value's display representation to the formatter stream.
impl<'a> FromValueRef<'a> for &'a Value
[src]
fn from_value_ref(v: &'a Value) -> Result<&'a Value, ExecError>
Returns the borrowed value
impl FromValue for Value
[src]
fn from_value(v: Value) -> Result<Value, ExecError>
Consumes the Value
and returns a Rust value