pub enum Value {
Unit,
Bool(bool),
Int(i64),
Float(f64),
Pid(u64),
Message(Message),
Cap(CapId),
Str(Arc<str>),
Bytes(Arc<[u8]>),
}Expand description
A dynamically-tagged runtime value.
Value::Cap is an opaque CapId for Send / Ask. Authority lives
in the runtime [crate::CapTable], keyed by holder — not in this tag.
Value::Pid remains for identity inside authenticated messages.
Value::Str / Value::Bytes are heap payloads shared via Arc.
Variants§
Unit
Bool(bool)
Int(i64)
Float(f64)
Pid(u64)
Internal / message identity (FlowId as u64). Not a Send target.
Message(Message)
Atomic Hop envelope. See Message.
Cap(CapId)
Opaque capability token. Required for Send / Ask.
Str(Arc<str>)
UTF-8 text (constant pool, natives, host).
Bytes(Arc<[u8]>)
Opaque byte buffer (constant pool, natives, host).
Implementations§
Source§impl Value
impl Value
Sourcepub fn str(s: impl AsRef<str>) -> Self
pub fn str(s: impl AsRef<str>) -> Self
Build a Value::Str from anything string-like.
Sourcepub fn bytes(b: impl AsRef<[u8]>) -> Self
pub fn bytes(b: impl AsRef<[u8]>) -> Self
Build a Value::Bytes from a byte slice.
Sourcepub fn is_truthy(&self) -> bool
pub fn is_truthy(&self) -> bool
Truthiness used by Opcode::Branch: falsy are Unit, Bool(false),
Int(0), empty Value::Str, and empty Value::Bytes.
pub fn as_int(&self) -> Option<i64>
pub fn as_pid(&self) -> Option<u64>
pub fn as_cap(&self) -> Option<CapId>
pub fn as_message(&self) -> Option<&Message>
pub fn as_str(&self) -> Option<&str>
pub fn as_bytes(&self) -> Option<&[u8]>
Sourcepub fn memory_size(&self) -> usize
pub fn memory_size(&self) -> usize
Bytes this value is charged for against a mailbox byte budget
(see crate::MailboxBytes).
Value::Str / Value::Bytes / hop payloads are Arc-shared: the
same buffer cloned into N mailboxes exists once in memory, but each
mailbox is charged the full length. That over-counts on purpose.
Sourcepub fn heap_size(&self) -> usize
pub fn heap_size(&self) -> usize
Heap bytes owned (transitively) by this value, excluding the enum itself.