Enum sparser::Value
[−]
[src]
pub enum Value { List(Cons), Symbol(String), Number(usize), Bool(bool), Literal(String), Null, }
Value represents all the things that are elements of the list expression
Variants
List(Cons)
A linked list
Symbol(String)
Symbol, eg. (if this than that), the word "if" is a symbol as well as "this", "than" and "that"
Number(usize)
A number
Bool(bool)
A boolean (true or false)
Literal(String)
A literal which is not futher parsed
Null
The end of a linked list
Methods
impl Value
[src]
fn car(self) -> Box<Value>
Gives the head of the list if value is a list
fn cdr(self) -> Box<Value>
Gives the tail of the list if value is a list
fn is_symbol(&self) -> bool
Gives true if the current value is a symbol false if not
fn is_number(&self) -> bool
Gives true if the current value is a number false if not
fn is_true(&self) -> bool
If the current value is a boolean, gives the value of that boolean otherwise false is returned
fn is_false(&self) -> bool
Oposite of is_true()
fn unwrap_symbol(self) -> String
Gives the symbol stored in the Value container
fn unwrap_number(self) -> usize
Gives the number stored in the Value container
fn unwrap_literal(self) -> String
Gives the literal contained in Value