ledvar_diff/lib.rs
1//! `ledvar-diff` — the **optional companion** to the Ledvar core: how to
2//! *represent* the comparison of two snapshots (DIFF.md).
3//!
4//! The comparison itself is a forced consequence of the core's hashes — match
5//! nodes by `identity_key`, then classify by `content_hash`. This crate fixes
6//! the shared vocabulary ([`StateStatus`], [`DiffNode`], [`DiffResult`]) so one
7//! component can produce a result and another can read it. It is domain-blind.
8//!
9//! ```
10//! use ledvar_diff::{diff, StateStatus};
11//! # use ledvar_core::Snapshot;
12//! # fn s() -> Snapshot { serde_json::from_str(r#"{"protocol_version":"0.1.0","origin_id":"o","provider_name":"p","timestamp":0,"tree":[]}"#).unwrap() }
13//! let result = diff(None, &s()).unwrap(); // cold start
14//! assert!(result.nodes.iter().all(|n| n.state_status == StateStatus::Baseline));
15//! ```
16
17#![forbid(unsafe_code)]
18#![warn(missing_docs)]
19
20mod compare;
21mod result;
22mod status;
23
24pub use compare::diff;
25pub use result::{DiffNode, DiffResult};
26pub use status::StateStatus;