pub trait ChangeReport:
Default
+ Clone
+ Debug {
// Required methods
fn any(&self) -> bool;
fn paths(&self) -> Vec<Vec<Cow<'static, str>>>;
fn leaf_paths(&self) -> Vec<Vec<Cow<'static, str>>>;
// Provided method
fn none(&self) -> bool { ... }
}Expand description
Trait for hierarchical change reports.
Generated *Changes types implement this trait to provide a uniform interface
for inspecting what changed in a document update.
§Example
use automorph::ChangeReport;
fn handle_changes(changes: &PersonChanges) {
if changes.any() {
for path in changes.leaf_paths() {
println!("Changed: {:?}", path);
}
}
}Required Methods§
Sourcefn paths(&self) -> Vec<Vec<Cow<'static, str>>>
fn paths(&self) -> Vec<Vec<Cow<'static, str>>>
Collects all changed field paths as strings.
For nested changes, returns paths at each level.
For example: [["baz"], ["baz", "wombat"], ["baz", "wombat", "x"]]
Uses Cow<'static, str> to support both static field names (borrowed)
and dynamic keys like HashMap keys or Vec indices (owned).
Sourcefn leaf_paths(&self) -> Vec<Vec<Cow<'static, str>>>
fn leaf_paths(&self) -> Vec<Vec<Cow<'static, str>>>
Collects only the leaf (deepest) changed field paths.
For example: [["baz", "wombat", "x"]] (not intermediate paths)
Uses Cow<'static, str> to support both static field names (borrowed)
and dynamic keys like HashMap keys or Vec indices (owned).
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.