[][src]Enum ketos::value::Value

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(RcString),
    Bytes(Bytes),
    Path(PathBuf),
    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<dyn 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(RcString)

String

Bytes(Bytes)

Byte string

Path(PathBuf)

Path

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<dyn ForeignValue>)

Boxed value of a foreign type

Methods

impl Value[src]

pub fn new_foreign<T: ForeignValue>(t: T) -> Value[src]

Returns a value of a foreign type.

pub fn new_foreign_fn<F>(name: Name, f: F) -> Value where
    F: Any + Fn(&Context, &mut [Value]) -> Result<Value, Error>, 
[src]

Returns a value containing a foreign function.

pub fn compare(&self, rhs: &Value) -> Result<Ordering, ExecError>[src]

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

pub fn is_equal(&self, rhs: &Value) -> Result<bool, ExecError>[src]

Tests two values for equality; returns an error if the values cannot be compared.

pub fn is_identical(&self, rhs: &Value) -> bool[src]

Returns whether this value is identical to another. The notable difference between this and eq is that float NaN values will compare equal.

pub fn take(&mut self) -> Value[src]

Replaces the value with Unit and returns the old value.

pub fn quasiquote(self, n: u32) -> Value[src]

Returns the value, quasi-quoted.

Panics

If n would overflow.

pub fn comma(self, n: u32) -> Value[src]

Returns the value, comma'd.

Panics

If n would overflow.

pub fn comma_at(self, n: u32) -> Value[src]

Returns the value, comma-at'd.

Panics

If n would overflow.

pub fn quote(self, n: u32) -> Value[src]

Returns the value, quoted.

Panics

If n would overflow.

pub fn type_name(&self) -> &'static str[src]

Returns a string describing the type of the value.

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

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

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

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

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

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

impl From<()> for Value[src]

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]

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]

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]

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]

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]

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]

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]

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]

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

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

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

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

impl From<Bytes> for Value[src]

impl From<Integer> for Value[src]

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

impl From<OsString> for Value[src]

impl From<PathBuf> for Value[src]

impl From<Ratio> for Value[src]

impl From<RcString> for Value[src]

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

impl From<String> for Value[src]

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

impl From<bool> for Value[src]

impl From<char> for Value[src]

impl From<f32> for Value[src]

impl From<f64> for Value[src]

impl From<i16> for Value[src]

impl From<i32> for Value[src]

impl From<i64> for Value[src]

impl From<i8> for Value[src]

impl From<isize> for Value[src]

impl From<u16> for Value[src]

impl From<u32> for Value[src]

impl From<u64> for Value[src]

impl From<u8> for Value[src]

impl From<usize> for Value[src]

impl FromValue for Value[src]

impl<'a> FromValueRef<'a> for &'a Value[src]

impl NameDebug for Value[src]

impl NameDisplay for Value[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,