Skip to main content

DiffNode

Struct DiffNode 

Source
pub struct DiffNode {
Show 13 fields pub action: String, pub item_type: String, pub path: String, pub sources: Vec<Source>, pub summary: Option<Summary>, pub tags: BTreeSet<String>, pub children: Vec<DiffNode>, pub details: BTreeMap<String, Value>, pub detail_blocks: Vec<DetailBlock>, pub annotations: Vec<Annotation>, pub source_items: Option<ItemPair>, pub diagnostics: Vec<Diagnostic>, pub artifacts: Vec<ArtifactDescriptor>,
}
Expand description

A node in the projected diff tree — the durable changeset structure consumed by renderers, serializers, and bindings.

Fields§

§action: String

Open enum: “add”, “remove”, “modify”, “move”, “reorder”, “schema_change”, etc. Plugins may define new actions.

§item_type: String

Open string: “directory”, “file”, “tabular”, “zip_archive”, etc. No built-in types — conventions, not enforcement.

§path: String

Location within snapshot (logical path, including interior paths like “archive.zip/>data/file.csv”). /> marks a decompose boundary; a literal segment beginning with > is escaped as \>.

§sources: Vec<Source>

Renderer-visible provenance for this projected node.

§summary: Option<Summary>

Optional structured one-liner describing the change. Set during projection; renderers format each Segment by its type. Build it with Summary’s builder, or pass a plain string — impl Into<Summary> wraps it as a single Segment::Text.

§tags: BTreeSet<String>

Open bag of semantic tags, namespaced by convention. e.g. “binoc.column-reorder”, “biobinoc.gap-change”

§children: Vec<DiffNode>

Child diff nodes forming the tree structure.

§details: BTreeMap<String, Value>

Structured payload, schema determined by item_type/action convention.

§detail_blocks: Vec<DetailBlock>

Renderer-visible, structured evidence blocks. Rule packs populate these with bounded examples while they still have domain knowledge; renderers decide how much to display.

§annotations: Vec<Annotation>

Renderer-visible annotations supplied by rule packs.

§source_items: Option<ItemPair>

The original item pair associated with this projected node when one is available. Session-scoped working data: available during a live run for rules and extractors that need to re-read source data. Callers writing changeset output must strip this via DiffNode::strip_transient before serializing.

§diagnostics: Vec<Diagnostic>

Node-scoped diagnostics emitted during a run. Transient: the controller hoists them into Changeset::diagnostics at the end of the diff, then clears this field so the output shape stays as one durable top-level diagnostics list.

§artifacts: Vec<ArtifactDescriptor>

Published artifacts for this node. Session-scoped working data: carried across the plugin ABI wire as descriptors (the bytes live in the shared data_root cache), but not meaningful outside a session. Callers writing changeset output must strip this via DiffNode::strip_transient before serializing.

Implementations§

Source§

impl DiffNode

Source

pub fn new( action: impl Into<String>, item_type: impl Into<String>, path: impl Into<String>, ) -> Self

Source

pub fn with_summary(self, summary: impl Into<Summary>) -> Self

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Source

pub fn with_detail(self, key: impl Into<String>, value: Value) -> Self

Source

pub fn with_children(self, children: Vec<DiffNode>) -> Self

Source

pub fn with_detail_block(self, block: DetailBlock) -> Self

Source

pub fn with_annotation_from( self, package: impl Into<String>, key: impl Into<String>, value: Value, ) -> Self

Source

pub fn with_source(self, source: Source) -> Self

Source

pub fn with_sources(self, sources: Vec<Source>) -> Self

Source

pub fn with_source_items(self, items: ItemPair) -> Self

Source

pub fn with_diagnostic(self, diagnostic: Diagnostic) -> Self

Source

pub fn with_artifact(self, artifact: ArtifactDescriptor) -> Self

Source

pub fn push_diagnostic(&mut self, diagnostic: Diagnostic)

Source

pub fn push_source(&mut self, source: Source)

Source

pub fn primary_from_source(&self) -> Option<&Source>

Source

pub fn annotate_from( &mut self, package: impl Into<String>, key: impl Into<String>, value: Value, )

Source

pub fn annotation(&self, package: &str, key: &str) -> Option<&Annotation>

Source

pub fn binoc_annotation(&self, key: &str) -> Option<&Annotation>

Source

pub fn node_count(&self) -> usize

Source

pub fn all_tags(&self) -> BTreeSet<String>

Source

pub fn strip_transient(&mut self)

Recursively clear session-scoped transient fields (source_items, diagnostics, artifacts) on this node and all descendants.

These fields are wire-visible so the plugin ABI can move them across process-ready boundaries, but they are not meaningful outside a live session and must be stripped before writing changeset output intended for users (JSON files, renderer output, Python return values).

Trait Implementations§

Source§

impl Clone for DiffNode

Source§

fn clone(&self) -> DiffNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiffNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DiffNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DiffNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,