pub enum Value {
Null,
Bool(bool),
Number(f64),
String(String),
Array(Vec<Value>),
Set(Vec<Value>),
Map(Vec<(String, Value)>),
Object(Vec<(String, Value)>),
}Expand description
A value that can be hashed.
This is the set of things the reference can hash, minus the ones that only
exist in JavaScript: there is no case for a function, a symbol, or a Date,
because a Rust caller would not pass one.
Value::Map and Value::Object are not interchangeable. They are the
reference’s Map and its plain object, which it encodes differently, so the
same entries produce a different digest under each. Pick the one that matches
what the other side of the conversation is hashing.
Variants§
Null
The absence of a value. Written Null, not the empty string.
Bool(bool)
A boolean.
Number(f64)
A number. An integer is written as a float that happens to be integral, because the reference has no separate integer case.
String(String)
A string.
Array(Vec<Value>)
A sequence whose order matters.
Set(Vec<Value>)
A collection whose order does not matter. This is the reference’s Map.
Map(Vec<(String, Value)>)
A mapping from strings to values, written in key order. This is the
reference’s Map.
Object(Vec<(String, Value)>)
A mapping from strings to values, written in key order with unquoted
keys. This is the reference’s plain object, and it is encoded differently
from Value::Map.