pub enum Value {
Show 56 variants
Nil,
Bool(bool),
Long(i64),
Double(f64),
BigInt(GcPtr<BigInt>),
BigDecimal(GcPtr<BigDecimal>),
Ratio(GcPtr<Ratio<BigInt>>),
Char(char),
Str(GcPtr<String>),
Uuid(u128),
Pattern(GcPtr<Pattern>),
Matcher(GcPtr<Matcher>),
Symbol(GcPtr<Symbol>),
Keyword(GcPtr<Keyword>),
List(GcPtr<PersistentList>),
Vector(GcPtr<PersistentVector>),
Map(MapValue),
Set(SetValue),
Queue(GcPtr<PersistentQueue>),
TransientMap(GcPtr<TransientMap>),
TransientSet(GcPtr<TransientSet>),
TransientVector(GcPtr<TransientVector>),
IntArray(GcPtr<Mutex<Vec<i32>>>),
LongArray(GcPtr<Mutex<Vec<i64>>>),
ShortArray(GcPtr<Mutex<Vec<i16>>>),
ByteArray(GcPtr<Mutex<Vec<i8>>>),
FloatArray(GcPtr<Mutex<Vec<f32>>>),
DoubleArray(GcPtr<Mutex<Vec<f64>>>),
BooleanArray(GcPtr<Mutex<Vec<bool>>>),
CharArray(GcPtr<Mutex<Vec<char>>>),
ObjectArray(GcPtr<ObjectArray>),
NativeFunction(GcPtr<NativeFn>),
Fn(GcPtr<CljxFn>),
Macro(GcPtr<CljxFn>),
BoundFn(GcPtr<BoundFn>),
Var(GcPtr<Var>),
Atom(GcPtr<Atom>),
SharedAtom(Arc<SharedAtom>),
ByteBlob(Arc<[u8]>),
Reduced(Box<Value>),
Namespace(GcPtr<Namespace>),
LazySeq(GcPtr<LazySeq>),
Cons(GcPtr<CljxCons>),
Protocol(GcPtr<Protocol>),
ProtocolFn(GcPtr<ProtocolFn>),
MultiFn(GcPtr<MultiFn>),
Volatile(GcPtr<Volatile>),
Delay(GcPtr<Delay>),
Promise(GcPtr<CljxPromise>),
Future(GcPtr<CljxFuture>),
Agent(GcPtr<Agent>),
TypeInstance(GcPtr<TypeInstance>),
NativeObject(GcPtr<NativeObjectBox>),
Resource(ResourceHandle),
WithMeta(Box<Value>, Box<Value>),
Error(GcPtr<ExceptionInfo>),
}Expand description
The central runtime type: every Clojure value is a Value.
Small scalars (Nil, Bool, Long, Double, Char) are stored inline.
All heap-allocated types go behind GcPtr so that clone() is O(1).
Variants§
Nil
Bool(bool)
Long(i64)
Double(f64)
BigInt(GcPtr<BigInt>)
BigDecimal(GcPtr<BigDecimal>)
Ratio(GcPtr<Ratio<BigInt>>)
Char(char)
Str(GcPtr<String>)
Uuid(u128)
Pattern(GcPtr<Pattern>)
Matcher(GcPtr<Matcher>)
Symbol(GcPtr<Symbol>)
Keyword(GcPtr<Keyword>)
List(GcPtr<PersistentList>)
Vector(GcPtr<PersistentVector>)
Map(MapValue)
Small maps (≤8 entries) are stored as an ArrayMap; larger ones as a HashMap. Also contains sorted map.
Set(SetValue)
Queue(GcPtr<PersistentQueue>)
TransientMap(GcPtr<TransientMap>)
TransientSet(GcPtr<TransientSet>)
TransientVector(GcPtr<TransientVector>)
IntArray(GcPtr<Mutex<Vec<i32>>>)
LongArray(GcPtr<Mutex<Vec<i64>>>)
ShortArray(GcPtr<Mutex<Vec<i16>>>)
ByteArray(GcPtr<Mutex<Vec<i8>>>)
FloatArray(GcPtr<Mutex<Vec<f32>>>)
DoubleArray(GcPtr<Mutex<Vec<f64>>>)
BooleanArray(GcPtr<Mutex<Vec<bool>>>)
CharArray(GcPtr<Mutex<Vec<char>>>)
ObjectArray(GcPtr<ObjectArray>)
NativeFunction(GcPtr<NativeFn>)
Fn(GcPtr<CljxFn>)
Macro(GcPtr<CljxFn>)
BoundFn(GcPtr<BoundFn>)
Var(GcPtr<Var>)
Atom(GcPtr<Atom>)
Cross-isolate mutable reference backed by Arc<ArcSwap<SharedValue>>.
Unlike Atom, a SharedAtom can cross the isolate boundary (the Arc
is cloned, not deep-copied) and its contents are lock-free CAS-swapped.
ByteBlob(Arc<[u8]>)
Immutable refcounted byte buffer (the BEAM off-heap-binary trick). Shared without copy across the isolate boundary; refcount drops to zero only when every isolate releases its reference.
Reduced(Box<Value>)
Namespace(GcPtr<Namespace>)
LazySeq(GcPtr<LazySeq>)
A deferred sequence cell — realized at most once.
Cons(GcPtr<CljxCons>)
A realized cons cell whose tail may itself be lazy.
Protocol(GcPtr<Protocol>)
ProtocolFn(GcPtr<ProtocolFn>)
MultiFn(GcPtr<MultiFn>)
Volatile(GcPtr<Volatile>)
Delay(GcPtr<Delay>)
Promise(GcPtr<CljxPromise>)
Future(GcPtr<CljxFuture>)
Agent(GcPtr<Agent>)
TypeInstance(GcPtr<TypeInstance>)
NativeObject(GcPtr<NativeObjectBox>)
Resource(ResourceHandle)
WithMeta(Box<Value>, Box<Value>)
A value with attached metadata. Transparent for equality, hashing, display.
Error(GcPtr<ExceptionInfo>)
Implementations§
Source§impl Value
impl Value
Sourcepub fn map_entry(key: Value, val: Value) -> Self
pub fn map_entry(key: Value, val: Value) -> Self
Convenience: build a [key val] map entry (a tagged 2-element vector).
Sourcepub fn is_map_entry(&self) -> bool
pub fn is_map_entry(&self) -> bool
True only for map entries ([k v] pairs from seq’ing a map, find,
or the map-entry constructor) — not for plain 2-element vectors.
Sourcepub fn is_sequential(&self) -> bool
pub fn is_sequential(&self) -> bool
True for sequential collections (list, vector, lazy seq, cons).