autosurgeon-0.7.0 has been yanked.
autosurgeon
Autosurgeon is a Rust library for working with data in automerge documents. See the documentation for a detailed guide.
Quickstart
autosurgeon requires rust 1.65 or newer.
Add autosurgeon to your dependencies with cargo add
cargo add autosurgeon
Then we can define a data model which derives Reconcile and Hydrate and
start reading and writing from automerge documents
use ;
// A simple contact document
let mut contact = Contact ;
// Put data into a document
let mut doc = new;
reconcile.unwrap;
// Get data out of a document
let contact2: Contact = hydrate.unwrap;
assert_eq!;
// Fork and make changes
let mut doc2 = doc.fork.with_actor;
let mut contact2: Contact = hydrate.unwrap;
contact2.name = "Dangermouse".to_string;
reconcile.unwrap;
// Concurrently on doc1
contact.address.line_one = "221C Baker St".to_string;
reconcile.unwrap;
// Now merge the documents
// Reconciled changes will merge in somewhat sensible ways
doc.merge.unwrap;
let merged: Contact = hydrate.unwrap;
assert_eq!