pub enum Value {
Null,
Number(f64),
Text(Arc<str>),
Bytes(Arc<Vec<u8>>),
List(Arc<Vec<Value>>),
Opaque(Arc<dyn Any + Send + Sync>),
Map(Arc<Vec<(String, Value)>>),
}Expand description
A datum crossing from one node to the next.
Arc wherever the data is heavy, because a value is cloned on every edge
and cloning must not copy.
Variants§
Null
Nothing. What a root node receives when you pass it no input.
Number(f64)
A number.
Text(Arc<str>)
UTF-8 text.
Bytes(Arc<Vec<u8>>)
Uninterpreted bytes.
List(Arc<Vec<Value>>)
Several values in order.
Opaque(Arc<dyn Any + Send + Sync>)
Something the core carries without looking at it, as dyn Any so the
core need not depend on PyO3.
It only exists in this process and in this run, and everything else follows: no content hash, no serialization, and no comparison but identity.
Map(Arc<Vec<(String, Value)>>)
Several named values: what a node with several incoming edges receives, keyed by the node that produced each one.
Ordered, in the edges’ declaration order: a HashMap iterates
differently in each process, so a content hash would be useless.
Implementations§
Source§impl Value
impl Value
Sourcepub fn map(pairs: impl Into<Vec<(String, Value)>>) -> Self
pub fn map(pairs: impl Into<Vec<(String, Value)>>) -> Self
A map, in the order you pass the pairs.
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
The value stored under that key, if this is a map and has it.
Sourcepub fn values(&self) -> Option<Vec<&Value>>
pub fn values(&self) -> Option<Vec<&Value>>
A map’s values, in order — flattening a map to a list is this.
Sourcepub fn opaque(x: impl Any + Send + Sync) -> Self
pub fn opaque(x: impl Any + Send + Sync) -> Self
Wraps something so it crosses the graph untouched.
Sourcepub fn downcast<T: Any + Send + Sync>(&self) -> Option<&T>
pub fn downcast<T: Any + Send + Sync>(&self) -> Option<&T>
What is inside an opaque, if it is of this type.