Expand description
Core Rust primitives for Spanfold.
Spanfold records typed temporal state windows, compares evidence across sources and stages, and exports deterministic audit artifacts. The crate provides strongly typed builders, histories, selectors, comparison plans, liveness helpers, and testing utilities without requiring a hosted runtime.
use spanfold::for_events;
#[derive(Clone)]
struct Event { id: &'static str, active: bool }
let mut pipeline = for_events::<Event>()
.record_windows()
.track_window("Active", |event| event.id, |event| event.active)
.build()?;
pipeline.ingest(Event { id: "one", active: true }, Some("source-a"), None)?;Re-exports§
pub use export::ComparisonDebugHtmlOptions;pub use export::ComparisonExportError;pub use export::ComparisonLlmContextOptions;pub use export::export_plan_json;pub use export::export_result_debug_html;pub use export::export_result_json;pub use export::export_result_json_lines;pub use export::export_result_llm_context;pub use export::export_result_markdown;pub use export::write_result_json_lines;pub use pipeline::ChildActivityView;pub use pipeline::EventPipeline;pub use pipeline::EventPipelineBuildError;pub use pipeline::EventPipelineBuilder;pub use pipeline::EventPipelineMetadata;pub use pipeline::IngestionError;pub use pipeline::IngestionResult;pub use pipeline::RollUpSegmentProjection;pub use pipeline::WindowEmission;pub use pipeline::WindowMetadata;pub use pipeline::WindowOptions;pub use pipeline::WindowPipelineBuilder;pub use pipeline::WindowTransitionKind;pub use pipeline::for_events;pub use records::ClosedWindow;pub use records::OpenWindow;pub use records::SummaryError;pub use records::WindowAnnotation;pub use records::WindowAnnotationTarget;pub use records::WindowBoundaryChange;pub use records::WindowBoundaryReason;pub use records::WindowGroupKind;pub use records::WindowGroupSummary;pub use records::WindowHistory;pub use records::WindowHistoryFixture;pub use records::WindowHistoryFixtureError;pub use records::WindowHistoryFixtureWindow;pub use records::WindowHistoryQuery;pub use records::WindowHistoryRefQuery;pub use records::WindowHistorySnapshot;pub use records::WindowMetadataError;pub use records::WindowOverlap;pub use records::WindowRecord;pub use records::WindowRecordId;pub use records::WindowResidualSegment;pub use records::WindowSegment;pub use records::WindowSnapshotQuery;pub use records::WindowSnapshotRecord;pub use records::WindowTag;pub use records::summarize_by_segment;pub use records::summarize_by_tag;pub use temporal::TemporalAxis;pub use temporal::TemporalPoint;pub use temporal::TemporalPointError;pub use temporal::TemporalRange;pub use temporal::TemporalRangeError;
Modules§
- export
- Portable comparison artifact encoders and atomic file sinks.
- pipeline
- Event-driven window pipeline and fallible ingestion API.
- records
- Window history, records, and query/summarization APIs.
- temporal
- Temporal axes, points, ranges, and domain validation.
Structs§
- Aligned
Comparison - Aligned comparison artifact.
- Aligned
Segment Artifact - Aligned segment artifact.
- AsOfRow
- As-of row.
- Cohort
Evidence Metadata - Parsed evidence for one cohort-aligned segment.
- Comparator
Parse Error - Detailed comparator declaration parse error.
- Comparator
Summary - Comparator summary.
- Comparison
Changelog Entry - Deterministic changelog entry between row-finality snapshots.
- Comparison
Diagnostic - Structured comparison diagnostic.
- Comparison
Extension Builder - Builder for immutable, metadata-only comparison extension descriptors.
- Comparison
Extension Comparator - Comparator descriptor exposed by a comparison extension.
- Comparison
Extension Descriptor - Immutable comparison extension descriptor.
- Comparison
Extension Metadata - Serializable metadata emitted by a comparison extension.
- Comparison
Extension Selector - Selector descriptor exposed by a comparison extension.
- Comparison
Normalization Policy - Describes how recorded windows are normalized before comparison.
- Comparison
Output Options - Describes output preferences for a comparison plan.
- Comparison
Plan - Typed comparison plan.
- Comparison
Result - Structured comparison result.
- Comparison
RowFinality - Finality metadata for a materialized row.
- Comparison
RowKind Parse Error - Error returned when a comparison row-kind label is unsupported.
- Comparison
RowMetadata Error - Error returned when result rows and finality metadata do not share the canonical count/kind layout.
- Comparison
RowWith Finality - Borrowed association between a typed comparison row and its result metadata.
- Comparison
Rows - Canonical comparator row collections used for storage and serialization.
- Comparison
Scope - Scope used to select the windows compared by a plan.
- Comparison
Selector - Describes a selection used by a window comparison plan.
- Containment
Row - Containment row.
- Contract
Fixture - Parsed contract fixture.
- Coverage
Row - Coverage for one aligned target-active segment.
- Coverage
Summary - Aggregate coverage summary for one window name, key, and partition.
- Excluded
Window Record - Excluded window artifact.
- GapRow
- Gap row.
- Hierarchy
Comparison Result - Hierarchy comparison result.
- Hierarchy
Comparison Row - One parent/child hierarchy segment.
- LaneKey
- Stable identity for one tracked source lane.
- Lane
Liveness Signal - A deterministic lane liveness state change.
- Lane
Liveness Tracker - Deterministic heartbeat/silence tracker for a fixed set of lanes.
- Lead
LagRow - Lead/lag row.
- Lead
LagSummary - Summary for one lead/lag comparator declaration.
- Missing
Row - Missing row.
- Normalized
Window Record - Normalized window artifact.
- Overlap
Row - Overlap row.
- Prepared
Comparison - Prepared comparison artifact.
- Residual
Row - Residual row.
- RowPoint
- Exported point for transition-based rows.
- RowRange
- Exported range for a row.
- Source
Matrix Cell - One directional source-matrix cell.
- Source
Matrix Result - Directional matrix across sources.
- Spanfold
Assert - Framework-neutral assertions for Spanfold comparison artifacts.
- Spanfold
Assertion Error - Assertion failure returned by Spanfold testing helpers.
- Spanfold
Snapshot - Snapshot normalization helpers for Spanfold artifacts.
- Symmetric
Difference Row - Symmetric-difference row.
- Virtual
Comparison Clock - Deterministic processing-position clock for comparison tests.
- Window
Artifact - Portable selected/excluded/normalized window artifact.
- Window
Comparison Builder - Fluent comparison builder over an existing recorded history.
- Window
Filter - Equality filter over tags or segments.
Enums§
- Against
Selection - Comparison-side selection.
- AsOf
Direction - As-of lookup direction.
- AsOf
Match Status - As-of lookup status.
- Cohort
Activity - Cohort activity rule.
- Comparator
- Comparator family supported by the Rust implementation.
- Comparison
Change Kind - Kind of state transition represented by a changelog entry.
- Comparison
Duplicate Window Policy - Duplicate normalized-window handling policy.
- Comparison
Explanation Format - Deterministic explanation output format.
- Comparison
Extension Build Error - Error returned when an extension descriptor is incomplete or ambiguous.
- Comparison
Finality - Finality state for an emitted row.
- Comparison
Null Timestamp Policy - Handling for records that do not have timestamps in event-time comparisons.
- Comparison
RowKind - Closed family of rows emitted by comparison results.
- Comparison
Selector Error - Selector construction error.
- Comparison
Side - The active side for a disagreement segment.
- Containment
Status - Containment classification for one target-active segment.
- Diagnostic
Severity - Diagnostic severity.
- Fixture
Error - Fixture loading and validation error.
- Hierarchy
Comparison RowKind - Hierarchy row interpretation.
- Lane
Liveness Error - Liveness tracker construction and evaluation errors.
- Lead
LagDirection - Lead/lag direction.
- Lead
LagTransition - Transition point used for lead/lag measurement.
- Open
Window Policy - Open-window normalization policy.
- Primitive
Value - JSON-compatible primitive value used by tags, segments, annotations, and fixture/import boundaries.
- Primitive
Value Error - Error returned when a primitive value cannot be represented safely.
Functions§
- align
- Aligns prepared normalized windows into deterministic segments.
- compare
- Executes a comparison over closed windows.
- compare_
hierarchy - Builds a hierarchy explanation across parent and child windows.
- compare_
live - Executes a live comparison by clipping open windows to an evaluation horizon.
- compare_
sources - Builds a directional source matrix.
- create_
changelog - Creates a changelog between row-finality snapshots.
- prepare
- Prepares a comparison without running comparators.
- prepare_
live - Prepares a live comparison by clipping open windows to an evaluation horizon.
- replay_
changelog - Replays a changelog over a previous row-finality snapshot.