Enum Value
pub enum Value {
Show 19 variants
Empty,
Int(isize),
Float(f64),
Bool(bool),
Char(char),
Str(Interned<'static, str>),
String(String),
Ref(usize),
Slice(usize, usize),
Array(Box<[ConValue]>),
Tuple(Box<[ConValue]>),
Struct(Interned<'static, str>, Box<HashMap<Interned<'static, str>, ConValue>>),
TupleStruct(Interned<'static, str>, Box<Box<[ConValue]>>),
Module(Box<HashMap<Interned<'static, str>, ConValue>>),
Quote(Rc<Expr>),
Function(Rc<Function>),
TupleConstructor(Constructor),
Closure(Rc<Closure>),
Builtin(&'static Builtin),
}Expand description
A Conlang value stores data in the interpreter
Variants§
Empty
The empty/unit () type
Int(isize)
An integer
Float(f64)
A floating point number
Bool(bool)
A boolean
Char(char)
A unicode character
Str(Interned<'static, str>)
A string literal
String(String)
A dynamic string
Ref(usize)
A reference
Slice(usize, usize)
A reference to an array
Array(Box<[ConValue]>)
An Array
Tuple(Box<[ConValue]>)
A tuple
Struct(Interned<'static, str>, Box<HashMap<Interned<'static, str>, ConValue>>)
A value of a product type
TupleStruct(Interned<'static, str>, Box<Box<[ConValue]>>)
A value of a product type with anonymous members
Module(Box<HashMap<Interned<'static, str>, ConValue>>)
An entire namespace
Quote(Rc<Expr>)
A quoted expression
Function(Rc<Function>)
A callable thing
TupleConstructor(Constructor)
A tuple constructor
Closure(Rc<Closure>)
A closure, capturing by reference
Builtin(&'static Builtin)
A built-in function
Implementations§
§impl ConValue
impl ConValue
pub fn typename(&self) -> &'static str
pub fn TupleStruct( id: Interned<'static, str>, values: Box<[ConValue]>, ) -> ConValue
pub fn Struct( id: Interned<'static, str>, values: HashMap<Interned<'static, str>, ConValue>, ) -> ConValue
pub fn index( &self, index: &ConValue, _env: &Environment, ) -> Result<ConValue, Error>
pub fn lt(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn lt(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn lt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn lt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn neq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn neq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn gt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn gt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn gt(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn gt(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
pub fn add_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn bitand_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn bitor_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn bitxor_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn div_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn mul_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn rem_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn shl_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn shr_assign(&mut self, other: ConValue) -> Result<(), Error>
pub fn sub_assign(&mut self, other: ConValue) -> Result<(), Error>
Trait Implementations§
§impl Callable for ConValue
impl Callable for ConValue
§fn call(
&self,
env: &mut Environment,
args: &[ConValue],
) -> Result<ConValue, Error>
fn call( &self, env: &mut Environment, args: &[ConValue], ) -> Result<ConValue, Error>
The Callable is responsible for checking the argument count and validating types