pub enum Value<C: 'static + Context> {
AtomicWord(AtomicIsize, C::ValueMeta),
BuiltinFunction(Symbol, C::BuiltinFunction, C::ValueMeta),
Byte(u8, C::ValueMeta),
Bytes(Gc<Vec<u8>>, C::ValueMeta),
Cons(Gc<Value<C>>, Gc<Value<C>>, C::ValueMeta),
Fixnum(isize, C::ValueMeta),
Func(Option<Symbol>, Gc<Args<C>>, C::UserFunction, C::ValueMeta),
Object(C::ObjectVtable, Vec<Gc<Value<C>>>, C::ValueMeta),
Nil(C::ValueMeta),
String(Gc<String>, C::ValueMeta),
Symbol(Symbol, C::ValueMeta),
Vector(Vec<Gc<Value<C>>>, C::ValueMeta),
}
Expand description
A single OftLisp value.
Variants§
AtomicWord(AtomicIsize, C::ValueMeta)
A mutable, signed, machine-sized integer.
BuiltinFunction(Symbol, C::BuiltinFunction, C::ValueMeta)
A built-in function.
Byte(u8, C::ValueMeta)
An unsigned 8-bit integer.
Bytes(Gc<Vec<u8>>, C::ValueMeta)
A vector of arbitrary bytes, not subject to the UTF-8 condition of Strings.
Cons(Gc<Value<C>>, Gc<Value<C>>, C::ValueMeta)
A cons cell, used to create lists, trees, and other data structures.
Fixnum(isize, C::ValueMeta)
A signed machine-sized integer.
Func(Option<Symbol>, Gc<Args<C>>, C::UserFunction, C::ValueMeta)
A user-defined function.
Object(C::ObjectVtable, Vec<Gc<Value<C>>>, C::ValueMeta)
The object type, containing a vtable and values.
Nil(C::ValueMeta)
The nil literal, used to terminate lists and signal failure (or the lack of interesting results).
String(Gc<String>, C::ValueMeta)
A UTF-8 string.
Symbol(Symbol, C::ValueMeta)
An interned symbol, which may be compared in O(1).
Vector(Vec<Gc<Value<C>>>, C::ValueMeta)
A fixed-length collection with O(1) lookup.
Implementations§
Source§impl<C: 'static + Context> Value<C>
impl<C: 'static + Context> Value<C>
Sourcepub fn improper_list<II: IntoIterator<Item = Gc<Value<C>>>>(
iter: II,
last: Gc<Value<C>>,
meta: C::ValueMeta,
) -> Gc<Value<C>>
pub fn improper_list<II: IntoIterator<Item = Gc<Value<C>>>>( iter: II, last: Gc<Value<C>>, meta: C::ValueMeta, ) -> Gc<Value<C>>
Converts an Iterator
and a last element to an improper cons-list.
Sourcepub fn list<II: IntoIterator<Item = Gc<Value<C>>>>(
iter: II,
meta: C::ValueMeta,
) -> Gc<Value<C>>
pub fn list<II: IntoIterator<Item = Gc<Value<C>>>>( iter: II, meta: C::ValueMeta, ) -> Gc<Value<C>>
Converts an Iterator
to a cons-list.
Sourcepub fn transmute_with<C2, F>(&self, f: &F) -> Option<Value<C2>>
pub fn transmute_with<C2, F>(&self, f: &F) -> Option<Value<C2>>
Converts a Value
between Context
s.
Will fail to transmute functions and objects.
Sourcepub fn transmute_data<C2: 'static + Context>(&self) -> Option<Value<C2>>
pub fn transmute_data<C2: 'static + Context>(&self) -> Option<Value<C2>>
Converts a Value
between Context
s.
Will fail to transmute functions and objects. Any metadata will be
discarded, with the default for the destination being used. To preserve
metadata, use transmute_with
instead.
Trait Implementations§
Source§impl<C: 'static + Context> PartialOrd for Value<C>
impl<C: 'static + Context> PartialOrd for Value<C>
Auto Trait Implementations§
impl<C> !Freeze for Value<C>
impl<C> !RefUnwindSafe for Value<C>
impl<C> !Send for Value<C>
impl<C> !Sync for Value<C>
impl<C> Unpin for Value<C>where
<C as Context>::ValueMeta: Unpin,
<C as Context>::BuiltinFunction: Unpin,
<C as Context>::UserFunction: Unpin,
<C as Context>::ObjectVtable: Unpin,
impl<C> !UnwindSafe for Value<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more