pub enum TypedCanonicalValue {
Null,
Bool(bool),
Integer(CanonicalInteger),
Binary64(f64),
String(String),
Array(Vec<TypedCanonicalValue>),
Object(Vec<(String, TypedCanonicalValue)>),
}Expand description
A strict JSON value that retains integer-versus-binary64 token kind.
TypedCanonicalValue::Object retains input order for diagnostics and
representation equality, but object order is not significant to TCV1.
Encoding validates raw and NFC-normalized key uniqueness and then sorts keys
by normalized UTF-8 bytes. Public variants permit construction without a
JSON round-trip;
tcv1_encode performs the same finite-number and object-key checks for
such values as parse_typed_json.
Variants§
Null
Bool(bool)
Integer(CanonicalInteger)
Binary64(f64)
String(String)
Array(Vec<TypedCanonicalValue>)
Object(Vec<(String, TypedCanonicalValue)>)
Implementations§
Source§impl TypedCanonicalValue
impl TypedCanonicalValue
Sourcepub fn fingerprint(&self) -> Result<String, Tcv1Error>
pub fn fingerprint(&self) -> Result<String, Tcv1Error>
Return the lowercase SHA-256 fingerprint of this value’s TCV1 preimage.
Sourcepub fn fingerprint_without(&self, key: &str) -> Result<String, Tcv1Error>
pub fn fingerprint_without(&self, key: &str) -> Result<String, Tcv1Error>
Fingerprint an object after removing exactly one normalized key.
This supports self-fingerprinted contracts without accepting ambiguous NFC aliases. The receiver must be an object and the requested key must occur exactly once after NFC normalization.
Trait Implementations§
Source§impl Clone for TypedCanonicalValue
impl Clone for TypedCanonicalValue
Source§fn clone(&self) -> TypedCanonicalValue
fn clone(&self) -> TypedCanonicalValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more