pub struct Condensate {
pub schema: SchemaId,
pub payload: CondensatePayload,
pub raw: Digest,
pub cap: usize,
pub lossy: bool,
pub slicer: SlicerId,
}Expand description
κ — an AST-preserved, size-capped, high-density summary of a result.
§Example
use boundgraph_core::{Condensate, CondensatePayload, Digest, SchemaId, SlicerId};
let raw = b"...ten thousand lines of build output...";
let k = Condensate::new(
SchemaId::new("boundgraph.log.v1", 1),
CondensatePayload::inline(&"3 errors, first at src/main.rs:42")?,
Digest::of(raw), // the original is still addressable
400, // the cap that was applied
true, // slicing dropped information
SlicerId::new("log", 1),
);
assert!(k.lossy);
assert_eq!(k.raw, Digest::of(raw));Fields§
§schema: SchemaIdThe shape of payload. A condensate is typed, never a
bare blob of text.
payload: CondensatePayloadThe summary itself, inline or stored.
raw: DigestThe complete, unmodified output this was derived from.
Always present, even when nothing was dropped, so an auditor never has to ask whether the original still exists.
cap: usizeThe token cap actually applied when slicing.
lossy: boolWhether slicing dropped information.
Set honestly by the slicer. A consumer that needs completeness must check this rather than assume.
slicer: SlicerIdWhich slicer produced this, and at what version.
Implementations§
Source§impl Condensate
impl Condensate
Sourcepub fn new(
schema: SchemaId,
payload: CondensatePayload,
raw: Digest,
cap: usize,
lossy: bool,
slicer: SlicerId,
) -> Self
pub fn new( schema: SchemaId, payload: CondensatePayload, raw: Digest, cap: usize, lossy: bool, slicer: SlicerId, ) -> Self
Construct a condensate.
Sourcepub fn needs_raw_for_completeness(&self) -> bool
pub fn needs_raw_for_completeness(&self) -> bool
Whether the full original must be fetched to see everything.
Equivalent to lossy, named for the question a caller
actually has.
Sourcepub const fn raw_digest(&self) -> &Digest
pub const fn raw_digest(&self) -> &Digest
Where to find the complete output.