automerge/rust/automerge/src
alexjg 08801ab580
automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511)
The Rust API has so far grown somewhat organically driven by the needs of the
javascript implementation. This has led to an API which is quite awkward and
unfamiliar to Rust programmers. Additionally there is no documentation to speak
of. This commit is the first movement towards cleaning things up a bit. We touch
a lot of files but the changes are all very mechanical. We introduce a few
traits to abstract over the common operations between `Automerge` and
`AutoCommit`, and add a whole bunch of documentation.

* Add a `ReadDoc` trait to describe methods which read value from a document.
  make `Transactable` extend `ReadDoc`
* Add a `SyncDoc` trait to describe methods necessary for synchronizing
  documents.
* Put the `SyncDoc` implementation for `AutoCommit` behind `AutoCommit::sync` to
  ensure that any open transactions are closed before taking part in the sync
  protocol
* Split `OpObserver` into two traits: `OpObserver` + `BranchableObserver`.
  `BranchableObserver` captures the methods which are only needed for observing
  transactions.
* Add a whole bunch of documentation.

The main changes Rust users will need to make is:

* Import the `ReadDoc` trait wherever you are using the methods which have been
  moved to it. Optionally change concrete paramters on functions to `ReadDoc`
  constraints.
* Likewise import the `SyncDoc` trait wherever you are doing synchronisation
  work
* If you are using the `AutoCommit::*_sync_message` methods you will need to add
  a call to `AutoCommit::sync()` first. E.g. `doc.generate_sync_message` becomes
  `doc.sync().generate_sync_message`
* If you have an implementation of `OpObserver` which you are using in an
  `AutoCommit` then split it into an implementation of `OpObserver` and
  `BranchableObserver`
2023-01-30 19:37:03 +00:00
..
automerge automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
columnar Add Fuzz Testing (#498) 2023-01-25 16:03:05 +00:00
legacy Ritual obeisance before the altar of clippy 2022-11-05 22:48:43 +00:00
op_observer automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
op_set Text v2. JS Api now uses text by default (#462) 2022-12-09 23:48:07 +00:00
op_tree change opid to (u32,u32) - 10% performance uptick (#473) 2022-12-11 18:56:20 +00:00
query fix: don't panic when generating parents for hidden objects (#500) 2023-01-19 21:11:36 +00:00
storage Add Fuzz Testing (#498) 2023-01-25 16:03:05 +00:00
sync automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
transaction automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
types change opid to (u32,u32) - 10% performance uptick (#473) 2022-12-11 18:56:20 +00:00
autocommit.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
automerge.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
autoserde.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
change.rs change opid to (u32,u32) - 10% performance uptick (#473) 2022-12-11 18:56:20 +00:00
clock.rs change opid to (u32,u32) - 10% performance uptick (#473) 2022-12-11 18:56:20 +00:00
clocks.rs Move rust workspace into ./rust 2022-10-16 19:55:51 +01:00
columnar.rs Move rust workspace into ./rust 2022-10-16 19:55:51 +01:00
convert.rs Move rust workspace into ./rust 2022-10-16 19:55:51 +01:00
decoding.rs Move rust workspace into ./rust 2022-10-16 19:55:51 +01:00
error.rs Text v2. JS Api now uses text by default (#462) 2022-12-09 23:48:07 +00:00
exid.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
indexed_cache.rs Move rust workspace into ./rust 2022-10-16 19:55:51 +01:00
keys.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
keys_at.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
lib.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
list_range.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
list_range_at.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
map_range.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
map_range_at.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
op_observer.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
op_set.rs fix: don't panic when generating parents for hidden objects (#500) 2023-01-19 21:11:36 +00:00
op_tree.rs change opid to (u32,u32) - 10% performance uptick (#473) 2022-12-11 18:56:20 +00:00
parents.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
query.rs fix: use saturating_sub when updating cached text width (#505) 2023-01-23 19:19:55 +00:00
read.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
sequence_tree.rs automerge-wasm: Use a SequenceTree in the OpObserver 2022-11-22 12:13:42 +00:00
storage.rs Add a method for loading a document without verifying heads 2022-12-19 16:30:14 +00:00
sync.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
transaction.rs rust: Make fields of Transaction and TransactionInner private 2022-12-02 12:12:54 +00:00
types.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
value.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
values.rs automerge-rs: Introduce ReadDoc and SyncDoc traits and add documentation (#511) 2023-01-30 19:37:03 +00:00
visualisation.rs rewrite opnode to store usize instead of Op (#471) 2022-12-10 10:36:05 +00:00