A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Find a file
2019-12-28 15:56:11 +00:00
src Add module documentation 2019-12-28 15:41:30 +00:00
tests Remove Skeptic 2019-12-28 15:03:23 +00:00
.gitignore Add travis 2019-12-28 14:52:05 +00:00
.travis.yml Add clippy to travis 2019-12-28 15:44:10 +00:00
Cargo.toml Rename to automerge 2019-12-28 15:56:11 +00:00
LICENSE Add license 2019-12-28 13:28:37 +00:00
README.md Rename to automerge 2019-12-28 15:56:11 +00:00

Automerge

docs

This is a very early, very much work in progress implementation of automerge in rust. At the moment it barely implements a read only view of operations received, with very little testing that it works. Objectives for it are:

  • Full read and write replication
  • no_std support to make it easy to use in WASM environments
  • Model based testing to ensure compatibility with the JS library

How to use

You'll need to export changes from automerge as JSON rather than using the encoding that Automerge.save uses. So first do this:

const doc = <your automerge document>
const changes = Automerge.getHistory(doc).map(h => h.change)
console.log(JSON.stringify(changes, null, 4))

Now you can load these changes into automerge like so:

extern crate automerge;

fn main() {
    let changes: Vec<automerge::Change> = serde_json::from_str("<paste the changes JSON here>").unwrap();
    let document = automerge::Document::load(changes).unwrap();
    let state: serde_json::Value = document.state().unwrap();
    println!("{:?}", state);
}