Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

DOC_VERSION

Constant DOC_VERSION 

Source
pub const DOC_VERSION: u8 = 0;
Expand description

The main CRDT document type for Eidetica.

Doc is a hierarchical key-value store with Last-Write-Wins (LWW) merge semantics. Keys can be simple strings or dot-separated paths for nested access.

§Examples

let mut doc = Doc::new();

// Simple key-value
doc.set("name", "Alice");
doc.set("age", 30);

// Nested paths (creates intermediate Doc nodes automatically)
doc.set("user.profile.bio", "Developer");

// Type-safe retrieval
assert_eq!(doc.get_as::<&str>("name"), Some("Alice"));
assert_eq!(doc.get_as::<i64>("age"), Some(30));
assert_eq!(doc.get_as::<&str>("user.profile.bio"), Some("Developer"));

§CRDT Merging

let mut doc1 = Doc::new();
doc1.set("name", "Alice");

let mut doc2 = Doc::new();
doc2.set("name", "Bob");
doc2.set("city", "NYC");

let merged = doc1.merge(&doc2).unwrap();
assert_eq!(merged.get_as::<&str>("name"), Some("Bob")); // Last write wins
assert_eq!(merged.get_as::<&str>("city"), Some("NYC")); // Added from doc2

Current CRDT format version for Doc.