Skip to main content

graphrefly_structures/
lib.rs

1//! `GraphReFly` reactive data structures (M5 — D177/D178/D179).
2//!
3//! Four reactive structures backed by pluggable backends, integrated at
4//! the Core level (no Graph dependency required):
5//!
6//! - [`ReactiveLog`] — append-only log with optional ring-buffer cap
7//! - [`ReactiveList`] — ordered list with positional insert/pop
8//! - [`ReactiveMap`] — key-value map with set/delete operations
9//! - [`ReactiveIndex`] — sorted index with primary key lookup + secondary sort
10//!
11//! Each structure owns a Core state `NodeId` and emits DIRTY→DATA snapshots
12//! on every mutation. Optional `mutation_log` companions record typed
13//! `BaseChange<XxxChange<T>>` deltas for op-log changesets (Phase 14).
14//!
15//! Default backends use `Vec<T>` / `HashMap<K, V>`. `imbl`-backed persistent
16//! backends are deferred until bench evidence justifies (D178).
17//!
18//! CRDT-backed variants (yrs / automerge / loro / diamond-types) are
19//! post-1.0 work, gated behind feature flags.
20//!
21//! # Status
22//!
23//! M5 complete (core + napi `BenchReactive*` parity). See
24//! `docs/migration-status.md` and `docs/porting-deferred.md` (F18/F19
25//! follow-ons).
26
27#![warn(rust_2018_idioms, unreachable_pub)]
28#![warn(clippy::pedantic)]
29#![allow(
30    clippy::module_name_repetitions,
31    clippy::missing_errors_doc,
32    clippy::missing_panics_doc,
33    clippy::must_use_candidate,
34    clippy::cast_possible_wrap,
35    clippy::cast_possible_truncation,
36    clippy::cast_sign_loss,
37    clippy::type_complexity,
38    clippy::doc_markdown
39)]
40#![forbid(unsafe_code)]
41
42pub mod backend;
43pub mod changeset;
44pub mod reactive;
45
46// Re-export core types for ergonomic access.
47pub use backend::{
48    HashMapBackend, IndexBackend, IndexRow, ListBackend, LogBackend, MapBackend, VecIndexBackend,
49    VecListBackend, VecLogBackend,
50};
51pub use changeset::{
52    BaseChange, DeleteReason, IndexChange, Lifecycle, ListChange, LogChange, MapChange, Version,
53};
54pub use reactive::{
55    AppendLogMode, AppendLogSink, AttachOptions, AttachStorageError, AttachStorageHandle,
56    IndexEqualsFn, IndexOutOfBounds, InternFn, LogView, MapConfigError, ReactiveIndex,
57    ReactiveIndexOptions, ReactiveList, ReactiveListOptions, ReactiveLog, ReactiveLogOptions,
58    ReactiveMap, ReactiveMapOptions, ReactiveSub, RetentionPolicy, ScanHandle, UpsertOptions,
59    ViewSpec,
60};