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(&Scope, &mut [Value]) -> Result<ValueError>

Returns a value containing a foreign function.

fn compare(&self, rhs: &Value) -> Result<OrderingExecError>

Compares two values; returns an error if the values cannot be compared.

fn is_equal(&self, rhs: &Value) -> Result<boolExecError>

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]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

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 ValueExecError>

Returns the borrowed value

impl FromValue for Value
[src]

fn from_value(v: Value) -> Result<ValueExecError>

Consumes the Value and returns a Rust value

impl From<()> for Value
[src]

fn from(_: ()) -> Value

Performs the conversion.

impl From<bool> for Value
[src]

fn from(b: bool) -> Value

Performs the conversion.

impl From<char> for Value
[src]

fn from(c: char) -> Value

Performs the conversion.

impl From<Integer> for Value
[src]

fn from(i: Integer) -> Value

Performs the conversion.

impl From<Ratio> for Value
[src]

fn from(r: Ratio) -> Value

Performs the conversion.

impl From<String> for Value
[src]

fn from(s: String) -> Value

Performs the conversion.

impl From<f32> for Value
[src]

fn from(f: f32) -> Value

Performs the conversion.

impl From<f64> for Value
[src]

fn from(f: f64) -> Value

Performs the conversion.

impl<'a> From<&'a str> for Value
[src]

fn from(s: &str) -> Value

Performs the conversion.

impl<T: Into<Value>> From<Vec<T>> for Value
[src]

fn from(v: Vec<T>) -> Value

Performs the conversion.

impl<'a, T: Clone + Into<Value>> From<&'a [T]> for Value
[src]

fn from(v: &[T]) -> Value

Performs the conversion.

impl<'a, T: Clone + Into<Value>> From<&'a mut [T]> for Value
[src]

fn from(v: &mut [T]) -> Value

Performs the conversion.

impl From<RcVec<Value>> for Value
[src]

fn from(v: RcVec<Value>) -> Value

Performs the conversion.

impl From<i8> for Value
[src]

fn from(i: i8) -> Value

Performs the conversion.

impl From<i16> for Value
[src]

fn from(i: i16) -> Value

Performs the conversion.

impl From<i32> for Value
[src]

fn from(i: i32) -> Value

Performs the conversion.

impl From<i64> for Value
[src]

fn from(i: i64) -> Value

Performs the conversion.

impl From<isize> for Value
[src]

fn from(i: isize) -> Value

Performs the conversion.

impl From<u8> for Value
[src]

fn from(i: u8) -> Value

Performs the conversion.

impl From<u16> for Value
[src]

fn from(i: u16) -> Value

Performs the conversion.

impl From<u32> for Value
[src]

fn from(i: u32) -> Value

Performs the conversion.

impl From<u64> for Value
[src]

fn from(i: u64) -> Value

Performs the conversion.

impl From<usize> for Value
[src]

fn from(i: usize) -> Value

Performs the conversion.

impl<A: Into<Value>> From<(A,)> for Value
[src]

fn from(v: (A,)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>> From<(A, B)> for Value
[src]

fn from(v: (A, B)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>> From<(A, B, C)> for Value
[src]

fn from(v: (A, B, C)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>> From<(A, B, C, D)> for Value
[src]

fn from(v: (A, B, C, D)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>> From<(A, B, C, D, E)> for Value
[src]

fn from(v: (A, B, C, D, E)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>> From<(A, B, C, D, E, F)> for Value
[src]

fn from(v: (A, B, C, D, E, F)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>> From<(A, B, C, D, E, F, G)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>, H: Into<Value>> From<(A, B, C, D, E, F, G, H)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G, H)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>, H: Into<Value>, I: Into<Value>> From<(A, B, C, D, E, F, G, H, I)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G, H, I)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>, H: Into<Value>, I: Into<Value>, J: Into<Value>> From<(A, B, C, D, E, F, G, H, I, J)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G, H, I, J)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>, H: Into<Value>, I: Into<Value>, J: Into<Value>, K: Into<Value>> From<(A, B, C, D, E, F, G, H, I, J, K)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G, H, I, J, K)) -> Value

Performs the conversion.

impl<A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>, F: Into<Value>, G: Into<Value>, H: Into<Value>, I: Into<Value>, J: Into<Value>, K: Into<Value>, L: Into<Value>> From<(A, B, C, D, E, F, G, H, I, J, K, L)> for Value
[src]

fn from(v: (A, B, C, D, E, F, G, H, I, J, K, L)) -> Value

Performs the conversion.