pub struct Node {
pub path: Vec<String>,
pub content: BTreeMap<String, BTreeSet<String>>,
pub labels: BTreeMap<String, String>,
pub refs: Vec<Ref>,
}Expand description
A node of the tree: identity (path) + content (attributes). The
collector fills it; this crate computes the hashes (SPEC §4.2, §5).
Fields§
§path: Vec<String>The node’s identity: its ordered location in the tree. Unique within a snapshot.
content: BTreeMap<String, BTreeSet<String>>Attributes: each name maps to a set of string values (a scalar is a one-element set).
labels: BTreeMap<String, String>Free-form annotation for grouping. Never hashed, never diffed.
refs: Vec<Ref>Directed annotation edges to other nodes. Never hashed, never diffed.
Implementations§
Source§impl Node
impl Node
Sourcepub fn identity_key(&self) -> Result<String, Error>
pub fn identity_key(&self) -> Result<String, Error>
identity_key = SHA-256 of the canonical path (“which node this is”).
Validates the node first — an implementation MUST NOT hash ill-formed input (SPEC §9), so an ill-formed node yields an error, never a hash.
Sourcepub fn content_hash(&self) -> Result<String, Error>
pub fn content_hash(&self) -> Result<String, Error>
content_hash = SHA-256 of the canonical content (“what the node is”).
Validates the node first — an implementation MUST NOT hash ill-formed input (SPEC §9), so an ill-formed node yields an error, never a hash.
Sourcepub fn canonical_path(&self) -> String
pub fn canonical_path(&self) -> String
The exact canonical bytes hashed for the identity (for inspection/debugging).
Not validated — these are bytes, not a hash; use Node::identity_key to hash.
Sourcepub fn canonical_content(&self) -> String
pub fn canonical_content(&self) -> String
The exact canonical bytes hashed for the content (for inspection/debugging).
Not validated — these are bytes, not a hash; use Node::content_hash to hash.