pub enum RuntimeKey {
Bool(bool),
Integer(i64),
FloatBits(u64),
Str(String),
Symbol(Symbol),
ObjectIdentity(u64),
}Expand description
A table key derived from a runtime value rather than a kernel Symbol.
Guest languages use this when table/hash/map keys are ordinary values. The key remains policy-controlled so each language decides which values are admissible and how numeric values collapse or stay distinct.
Variants§
Bool(bool)
Boolean key.
Integer(i64)
Integer key.
FloatBits(u64)
Floating-point key represented by its raw IEEE-754 bits.
Str(String)
Text key.
Symbol(Symbol)
Symbol key.
ObjectIdentity(u64)
Object identity key, local to this runtime process.
Implementations§
Source§impl RuntimeKey
impl RuntimeKey
Sourcepub fn from_value(cx: &mut Cx, value: &Value) -> Result<Option<Self>>
pub fn from_value(cx: &mut Cx, value: &Value) -> Result<Option<Self>>
Derives a general-purpose key from value.
Nil and NaN are rejected with None; booleans, numbers, strings, and
symbols become structural keys; every other value is keyed by object
identity. Guest languages can call this from their own
RuntimeKeyPolicy or provide a stricter mapping.
Sourcepub fn as_integer_index(&self) -> Option<i64>
pub fn as_integer_index(&self) -> Option<i64>
Returns this key as a contiguous integer index when it is one.
Trait Implementations§
Source§impl Clone for RuntimeKey
impl Clone for RuntimeKey
Source§fn clone(&self) -> RuntimeKey
fn clone(&self) -> RuntimeKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more