Struct AutoCommit
pub struct AutoCommit { /* private fields */ }Expand description
An automerge document that automatically manages transactions.
§Creating, loading, merging and forking documents
A new document can be created with Self::new(), which will create a document with a random
ActorId. Existing documents can be loaded with Self::load().
If you have two documents and you want to merge the changes from one into the other you can use
Self::merge().
If you have a document you want to split into two concurrent threads of execution you can use
Self::fork(). If you want to split a document from ealier in its history you can use
Self::fork_at().
§Reading values
Self implements ReadDoc, which provides methods for reading values from the document.
§Modifying a document
This type implements Transactable directly, so you can modify it using methods from Transactable.
§Synchronization
To synchronise call Self::sync() which returns an implementation of SyncDoc
§Patches, maintaining materialized views
AutoCommit allows you to generate Patches representing changes to the current state of
the document which you can use to maintain a materialized view of the current state. There are
several ways to use this. See the documentation on Self::diff() for more details, but the key
point to remember is that AutoCommit manages an internal “diff cursor” for you. This is a
representation of the heads of the document last time you called Self::diff_incremental()
but you can also manage it directly using Self::update_diff_cursor() and
Self::reset_diff_cursor().
§Authors and Actors
See the “Authors and Actors” docs.
Implementations§
§impl AutoCommit
impl AutoCommit
pub fn new() -> AutoCommit
pub fn diff_opset(&self, other: &AutoCommit) -> Result<(), AutomergeError>
pub fn new_with_encoding(encoding: TextEncoding) -> AutoCommit
pub fn anonymize(&mut self) -> Result<AutoCommit, AnonymizeError>
pub fn anonymize(&mut self) -> Result<AutoCommit, AnonymizeError>
Return a copy of this document with its data anonymized.
pub fn load(data: &[u8]) -> Result<AutoCommit, AutomergeError>
pub fn load_unverified_heads(data: &[u8]) -> Result<AutoCommit, AutomergeError>
pub fn load_with( data: &[u8], on_error: OnPartialLoad, mode: VerificationMode, ) -> Result<AutoCommit, AutomergeError>
use load_with_options instead
pub fn load_with_options( data: &[u8], options: LoadOptions<'_>, ) -> Result<AutoCommit, AutomergeError>
pub fn reset_diff_cursor(&mut self)
pub fn reset_diff_cursor(&mut self)
Erases the diff cursor created by Self::update_diff_cursor() and no
longer indexes changes to the document.
pub fn update_diff_cursor(&mut self)
pub fn update_diff_cursor(&mut self)
Sets the Self::diff_cursor() to current heads of the document and will begin
building an index with every change moving forward.
If Self::diff() is called with Self::diff_cursor() as before and
Self::get_heads() as after - the index will be used
If the cursor is no longer needed it can be reset with
Self::reset_diff_cursor()
pub fn diff_cursor(&self) -> Vec<ChangeHash>
pub fn diff_cursor(&self) -> Vec<ChangeHash>
Returns the cursor set by Self::update_diff_cursor()
pub fn make_patches(&self, patch_log: &mut PatchLog) -> Vec<Patch>
pub fn make_patches(&self, patch_log: &mut PatchLog) -> Vec<Patch>
Generate the patches recorded in patch_log
pub fn diff(
&mut self,
before: &[ChangeHash],
after: &[ChangeHash],
) -> Vec<Patch>
pub fn diff( &mut self, before: &[ChangeHash], after: &[ChangeHash], ) -> Vec<Patch>
Generates a diff from before to after
By default the diff requires a sequental scan of all the ops in the doc.
To do a fast indexed diff before must equal Self::diff_cursor() and
after must equal Self::get_heads(). The diff cursor is managed with
Self::update_diff_cursor() and Self::reset_diff_cursor()
Managing the diff index has a small but non-zero overhead. It should be disabled if no longer needed. If a signifigantly large change is applied to the document it may be faster to reset the index before applying it, doing an unindxed diff afterwards and then reenable the index.
§Arguments
before- heads fromSelf::get_heads()at beginning point in the documents historyafter- heads fromSelf::get_heads()at ending point in the documents history.
Note: before and after do not have to be chronological. Document state can move backward.
Normal use might look like:
§Example
use automerge::{ AutoCommit };
let mut doc = AutoCommit::new(); // or AutoCommit::load(data)
// make some changes - use and update the index
let heads = doc.get_heads();
let diff_cursor = doc.diff_cursor();
let patches = doc.diff(&diff_cursor, &heads);
doc.update_diff_cursor();See Self::diff_incremental() for encapsulating this pattern.
pub fn diff_obj(
&mut self,
obj: &ExId,
before: &[ChangeHash],
after: &[ChangeHash],
recursive: bool,
) -> Result<Vec<Patch>, AutomergeError>
pub fn diff_obj( &mut self, obj: &ExId, before: &[ChangeHash], after: &[ChangeHash], recursive: bool, ) -> Result<Vec<Patch>, AutomergeError>
Generates a diff from before to after for a given object
By default the diff requires a sequental scan of all the ops in the doc.
Self::diff() is the equivelent to [Self::diff_obj(&ROOT, before, after)]
Managing the diff index has a small but non-zero overhead. It should be disabled if no longer needed. If a signifigantly large change is applied to the document it may be faster to reset the index before applying it, doing an unindxed diff afterwards and then reenable the index.
§Arguments
obj- The object to start the diff at.before- heads fromSelf::get_heads()at beginning point in the documents historyafter- heads fromSelf::get_heads()at ending point in the documents history.recursive- if false, do not also diff child objects
Note: before and after do not have to be chronological. Document state can move backward.
pub fn diff_incremental(&mut self) -> Vec<Patch>
pub fn diff_incremental(&mut self) -> Vec<Patch>
This is a convience function that encapsulates the following common pattern
use automerge::AutoCommit;
let mut doc = AutoCommit::new();
// make some changes
let heads = doc.get_heads();
let diff_cursor = doc.diff_cursor();
let patches = doc.diff(&diff_cursor, &heads);
doc.update_diff_cursor();pub fn fork(&mut self) -> AutoCommit
pub fn fork_at( &mut self, heads: &[ChangeHash], ) -> Result<AutoCommit, AutomergeError>
pub fn committed_document(&self) -> &Automerge
pub fn committed_document(&self) -> &Automerge
The committed document: everything but the changes of a transaction
still open. Reads it without closing that transaction, so a holder of
&self can read history; a host that commits before handing the
document out sees all of it.
pub fn committed_heads(&self) -> Vec<ChangeHash>
pub fn committed_heads(&self) -> Vec<ChangeHash>
The heads of the committed document (Self::committed_document),
or of the isolated view when the document is isolated: what
Self::get_heads answers once no transaction is open.
pub fn committed_fork_at(
&self,
heads: &[ChangeHash],
) -> Result<AutoCommit, AutomergeError>
pub fn committed_fork_at( &self, heads: &[ChangeHash], ) -> Result<AutoCommit, AutomergeError>
A copy of the committed document (Self::committed_document) as it
was at heads: what Self::fork_at makes, read from &self.
pub fn committed_diff(
&self,
before: &[ChangeHash],
after: &[ChangeHash],
) -> Vec<Patch>
pub fn committed_diff( &self, before: &[ChangeHash], after: &[ChangeHash], ) -> Vec<Patch>
The patches from before to after in the committed document
(Self::committed_document), without the diff cursor or cache
Self::diff keeps.
pub fn with_actor(self, actor: ActorId) -> AutoCommit
pub fn set_actor(&mut self, actor: ActorId) -> &mut AutoCommit
pub fn get_actor(&self) -> &ActorId
pub fn isolate(&mut self, heads: &[ChangeHash])
pub fn integrate(&mut self)
pub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
pub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
Load an incremental save of a document.
Unlike Self::load() this imports changes into an existing document. It will work with both
the output of Self::save() and Self::save_incremental()
The return value is the number of ops which were applied, this is not useful and will change in future.
pub fn apply_changes( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
pub fn apply_changes_batch( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
pub fn merge(
&mut self,
other: &mut AutoCommit,
) -> Result<Vec<ChangeHash>, AutomergeError>
pub fn merge( &mut self, other: &mut AutoCommit, ) -> Result<Vec<ChangeHash>, AutomergeError>
Takes all the changes in other which are not in self and applies them
pub fn save_with_options(&mut self, options: SaveOptions) -> Vec<u8> ⓘ
pub fn save_and_verify(&mut self) -> Result<Vec<u8>, AutomergeError>
pub fn save_and_verify(&mut self) -> Result<Vec<u8>, AutomergeError>
Save the document and attempt to load it before returning - slow!
pub fn bundle<I>(&self, hashes: I) -> Result<Bundle, AutomergeError>where
I: IntoIterator<Item = ChangeHash>,
pub fn bundle<I>(&self, hashes: I) -> Result<Bundle, AutomergeError>where
I: IntoIterator<Item = ChangeHash>,
EXPERIMENTAL: Write the set of changes in hashes to a “bundle”
A “bundle” is a compact representation of a set of changes which uses
the same compression tricks as the document encoding we use in
Automerge::save.
This is an experimental API, the bundle format is still subject to change and so should not be used in production just yet.
pub fn save_nocompress(&mut self) -> Vec<u8> ⓘ
pub fn save_nocompress(&mut self) -> Vec<u8> ⓘ
Save this document, but don’t run it through DEFLATE afterwards
pub fn save_incremental(&mut self) -> Vec<u8> ⓘ
pub fn save_incremental(&mut self) -> Vec<u8> ⓘ
Save the changes since the last call to Self::save()
The output of this will not be a compressed document format, but a series of individual
changes. This is useful if you know you have only made a small change since the last Self::save()
and you want to immediately send it somewhere (e.g. you’ve inserted a single character in a
text object).
pub fn is_empty(&self) -> bool
pub fn save_after(&mut self, heads: &[ChangeHash]) -> Vec<u8> ⓘ
pub fn save_after(&mut self, heads: &[ChangeHash]) -> Vec<u8> ⓘ
Save everything which is not a (transitive) dependency of heads
pub fn get_missing_deps(&mut self, heads: &[ChangeHash]) -> Vec<ChangeHash>
pub fn get_last_local_change(&mut self) -> Option<Change>
pub fn get_last_local_change(&mut self) -> Option<Change>
Get the last change made by this documents actor ID
pub fn get_changes(&mut self, have_deps: &[ChangeHash]) -> Vec<Change>
pub fn get_changes_meta( &mut self, have_deps: &[ChangeHash], ) -> Vec<ChangeMetadata<'_>>
pub fn get_change_by_hash(&mut self, hash: &ChangeHash) -> Option<Change>
pub fn get_change_meta_by_hash( &mut self, hash: &ChangeHash, ) -> Option<ChangeMetadata<'_>>
pub fn get_changes_added(&mut self, other: &mut AutoCommit) -> Vec<Change>
pub fn get_changes_added(&mut self, other: &mut AutoCommit) -> Vec<Change>
Get changes in other that are not in self
pub fn get_heads(&mut self) -> Vec<ChangeHash>
pub fn get_heads(&mut self) -> Vec<ChangeHash>
Get the current heads of the document.
This closes the transaction first, if one is in progress.
pub fn commit(&mut self) -> Option<ChangeHash>
pub fn commit(&mut self) -> Option<ChangeHash>
Commit any uncommitted changes
Returns None if there were no operations to commit
pub fn commit_with(&mut self, options: CommitOptions) -> Option<ChangeHash>
pub fn commit_with(&mut self, options: CommitOptions) -> Option<ChangeHash>
Commit the current operations with some options.
Returns None if there were no operations to commit
let mut doc = AutoCommit::new();
doc.put_object(&ROOT, "todos", ObjType::List).unwrap();
let now = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs() as
i64;
doc.commit_with(CommitOptions::default().with_message("Create todos list").with_time(now));pub fn rollback(&mut self) -> usize
pub fn rollback(&mut self) -> usize
Remove any changes that have been made in the current transaction from the document
pub fn empty_change(&mut self, options: CommitOptions) -> ChangeHash
pub fn empty_change(&mut self, options: CommitOptions) -> ChangeHash
Generate an empty change
The main reason to do this is if you wish to create a “merge commit” which has all the current heads of the documents as dependencies but you have no new operations to create.
Because this structure is an “autocommit” there may actually be outstanding operations to
submit. If this is the case this function will create two changes, one with the outstanding
operations and a new one with no operations. The returned ChangeHash will always be the
hash of the empty change.
pub fn sync(&mut self) -> impl SyncDoc
pub fn sync(&mut self) -> impl SyncDoc
An implementation of crate::sync::SyncDoc for this autocommit
This ensures that any outstanding transactions for this document are committed before taking part in the sync protocol
pub fn hash_for_opid(&self, opid: &ExId) -> Option<ChangeHash>
pub fn hash_for_opid(&self, opid: &ExId) -> Option<ChangeHash>
Get the hash of the change that contains the given opid.
Returns None if the opid:
- Is the root object id
- Does not exist in this document
- Is for an operation in a transaction
pub fn has_our_changes(&mut self, state: &State) -> bool
pub fn has_our_changes(&mut self, state: &State) -> bool
Whether the peer represented by other has all the changes we have
Trait Implementations§
§impl ApplyIncoming for AutoCommit
impl ApplyIncoming for AutoCommit
§fn apply_incoming(
&mut self,
changes: impl IntoIterator<Item = Change> + Clone,
) -> Result<(), AutomergeError>
fn apply_incoming( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
§fn apply_incoming_batch(
&mut self,
changes: impl IntoIterator<Item = Change> + Clone,
) -> Result<(), AutomergeError>
fn apply_incoming_batch( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
§fn load_incoming(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
fn load_incoming(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
AutoCommit::load_incremental: the number of ops applied. Read more§fn merge_incoming(
&mut self,
other: &mut AutoCommit,
) -> Result<Vec<ChangeHash>, AutomergeError>
fn merge_incoming( &mut self, other: &mut AutoCommit, ) -> Result<Vec<ChangeHash>, AutomergeError>
§fn receive_incoming_sync(
&mut self,
state: &mut State,
message: Message,
) -> Result<(), AutomergeError>
fn receive_incoming_sync( &mut self, state: &mut State, message: Message, ) -> Result<(), AutomergeError>
§fn isolate_at(&mut self, heads: &[ChangeHash])
fn isolate_at(&mut self, heads: &[ChangeHash])
AutoCommit::isolate: view the document at heads.§fn integrate_all(&mut self)
fn integrate_all(&mut self)
AutoCommit::integrate: leave an isolated view for the current heads.§impl Clone for AutoCommit
impl Clone for AutoCommit
§fn clone(&self) -> AutoCommit
fn clone(&self) -> AutoCommit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl CommitNamed for AutoCommit
impl CommitNamed for AutoCommit
§fn commit_edit(&mut self, kind: &str, field: &str) -> Option<ChangeHash>
fn commit_edit(&mut self, kind: &str, field: &str) -> Option<ChangeHash>
field on a record
of kind kind.§impl Debug for AutoCommit
impl Debug for AutoCommit
§impl Default for AutoCommit
An autocommit document with an inactive PatchLog
impl Default for AutoCommit
An autocommit document with an inactive PatchLog
See AutoCommit
§fn default() -> AutoCommit
fn default() -> AutoCommit
§impl ReadDoc for AutoCommit
impl ReadDoc for AutoCommit
§fn parents<O>(&self, obj: O) -> Result<Parents<'_>, AutomergeError>
fn parents<O>(&self, obj: O) -> Result<Parents<'_>, AutomergeError>
§fn parents_at<O>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Parents<'_>, AutomergeError>
fn parents_at<O>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Parents<'_>, AutomergeError>
§fn keys_at<O>(&self, obj: O, heads: &[ChangeHash]) -> Keys<'_> ⓘ
fn keys_at<O>(&self, obj: O, heads: &[ChangeHash]) -> Keys<'_> ⓘ
§fn map_range<'a, O, R>(&'a self, obj: O, range: R) -> MapRange<'a> ⓘ
fn map_range<'a, O, R>(&'a self, obj: O, range: R) -> MapRange<'a> ⓘ
obj in the given range. Read more§fn map_range_at<'a, O, R>(
&'a self,
obj: O,
range: R,
heads: &[ChangeHash],
) -> MapRange<'a> ⓘ
fn map_range_at<'a, O, R>( &'a self, obj: O, range: R, heads: &[ChangeHash], ) -> MapRange<'a> ⓘ
§fn list_range<O, R>(&self, obj: O, range: R) -> ListRange<'_> ⓘ
fn list_range<O, R>(&self, obj: O, range: R) -> ListRange<'_> ⓘ
obj in the given range. Read more§fn list_range_at<O, R>(
&self,
obj: O,
range: R,
heads: &[ChangeHash],
) -> ListRange<'_> ⓘ
fn list_range_at<O, R>( &self, obj: O, range: R, heads: &[ChangeHash], ) -> ListRange<'_> ⓘ
obj in the given range as at heads Read more§fn values<O>(&self, obj: O) -> Values<'_> ⓘ
fn values<O>(&self, obj: O) -> Values<'_> ⓘ
§fn values_at<O>(&self, obj: O, heads: &[ChangeHash]) -> Values<'_> ⓘ
fn values_at<O>(&self, obj: O, heads: &[ChangeHash]) -> Values<'_> ⓘ
heads Read more§fn length_at<O>(&self, obj: O, heads: &[ChangeHash]) -> usize
fn length_at<O>(&self, obj: O, heads: &[ChangeHash]) -> usize
heads Read more§fn object_type<O>(&self, obj: O) -> Result<ObjType, AutomergeError>
fn object_type<O>(&self, obj: O) -> Result<ObjType, AutomergeError>
§fn marks_at<O>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Vec<Mark>, AutomergeError>
fn marks_at<O>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Vec<Mark>, AutomergeError>
fn get_marks<O>( &self, obj: O, index: usize, heads: Option<&[ChangeHash]>, ) -> Result<MarkSet, AutomergeError>
§fn text<O>(&self, obj: O) -> Result<String, AutomergeError>
fn text<O>(&self, obj: O) -> Result<String, AutomergeError>
§fn text_at<O>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<String, AutomergeError>
fn text_at<O>( &self, obj: O, heads: &[ChangeHash], ) -> Result<String, AutomergeError>
heads, see
Self::text()§fn spans<O>(&self, obj: O) -> Result<Spans<'_>, AutomergeError>
fn spans<O>(&self, obj: O) -> Result<Spans<'_>, AutomergeError>
obj§fn spans_at<O>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Spans<'_>, AutomergeError>
fn spans_at<O>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Spans<'_>, AutomergeError>
obj as at heads§fn get_cursor<O, I>(
&self,
obj: O,
position: I,
at: Option<&[ChangeHash]>,
) -> Result<Cursor, AutomergeError>
fn get_cursor<O, I>( &self, obj: O, position: I, at: Option<&[ChangeHash]>, ) -> Result<Cursor, AutomergeError>
usize position in a Sequence (either ObjType::List or ObjType::Text). Read more§fn get_cursor_moving<O, I>(
&self,
obj: O,
position: I,
at: Option<&[ChangeHash]>,
move_cursor: MoveCursor,
) -> Result<Cursor, AutomergeError>
fn get_cursor_moving<O, I>( &self, obj: O, position: I, at: Option<&[ChangeHash]>, move_cursor: MoveCursor, ) -> Result<Cursor, AutomergeError>
usize position in a Sequence (either ObjType::List or ObjType::Text). Read more§fn get_cursor_position<O>(
&self,
obj: O,
cursor: &Cursor,
at: Option<&[ChangeHash]>,
) -> Result<usize, AutomergeError>
fn get_cursor_position<O>( &self, obj: O, cursor: &Cursor, at: Option<&[ChangeHash]>, ) -> Result<usize, AutomergeError>
fn hydrate<O>( &self, obj: O, heads: Option<&[ChangeHash]>, ) -> Result<Value, AutomergeError>
§fn get<O, P>(
&self,
obj: O,
prop: P,
) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
fn get<O, P>( &self, obj: O, prop: P, ) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
§fn get_at<O, P>(
&self,
obj: O,
prop: P,
heads: &[ChangeHash],
) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
fn get_at<O, P>( &self, obj: O, prop: P, heads: &[ChangeHash], ) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
heads, see Self::get()§fn get_all<O, P>(
&self,
obj: O,
prop: P,
) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
fn get_all<O, P>( &self, obj: O, prop: P, ) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
§fn get_all_at<O, P>(
&self,
obj: O,
prop: P,
heads: &[ChangeHash],
) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
fn get_all_at<O, P>( &self, obj: O, prop: P, heads: &[ChangeHash], ) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
heads Read more§fn get_missing_deps(&self, heads: &[ChangeHash]) -> Vec<ChangeHash>
fn get_missing_deps(&self, heads: &[ChangeHash]) -> Vec<ChangeHash>
heads.§fn get_change_by_hash(&self, hash: &ChangeHash) -> Option<Change>
fn get_change_by_hash(&self, hash: &ChangeHash) -> Option<Change>
fn text_encoding(&self) -> TextEncoding
§impl Transactable for AutoCommit
impl Transactable for AutoCommit
§fn splice<O, V, I>(
&mut self,
obj: O,
pos: usize,
del: isize,
vals: I,
) -> Result<(), AutomergeError>
fn splice<O, V, I>( &mut self, obj: O, pos: usize, del: isize, vals: I, ) -> Result<(), AutomergeError>
Splice new elements into the given sequence
§fn pending_ops(&self) -> usize
fn pending_ops(&self) -> usize
§fn put<O, P, V>(
&mut self,
obj: O,
prop: P,
value: V,
) -> Result<(), AutomergeError>
fn put<O, P, V>( &mut self, obj: O, prop: P, value: V, ) -> Result<(), AutomergeError>
§fn put_object<O, P>(
&mut self,
obj: O,
prop: P,
value: ObjType,
) -> Result<ExId, AutomergeError>
fn put_object<O, P>( &mut self, obj: O, prop: P, value: ObjType, ) -> Result<ExId, AutomergeError>
§fn insert<O, V>(
&mut self,
obj: O,
index: usize,
value: V,
) -> Result<(), AutomergeError>
fn insert<O, V>( &mut self, obj: O, index: usize, value: V, ) -> Result<(), AutomergeError>
§fn insert_object<O>(
&mut self,
obj: O,
index: usize,
value: ObjType,
) -> Result<ExId, AutomergeError>
fn insert_object<O>( &mut self, obj: O, index: usize, value: ObjType, ) -> Result<ExId, AutomergeError>
§fn increment<O, P>(
&mut self,
obj: O,
prop: P,
value: i64,
) -> Result<(), AutomergeError>
fn increment<O, P>( &mut self, obj: O, prop: P, value: i64, ) -> Result<(), AutomergeError>
value.§fn delete<O, P>(&mut self, obj: O, prop: P) -> Result<(), AutomergeError>
fn delete<O, P>(&mut self, obj: O, prop: P) -> Result<(), AutomergeError>
§fn splice_text<O>(
&mut self,
obj: O,
pos: usize,
del: isize,
text: &str,
) -> Result<(), AutomergeError>
fn splice_text<O>( &mut self, obj: O, pos: usize, del: isize, text: &str, ) -> Result<(), AutomergeError>
Self::splice but for text.§fn mark<O>(
&mut self,
obj: O,
mark: Mark,
expand: ExpandMark,
) -> Result<(), AutomergeError>
fn mark<O>( &mut self, obj: O, mark: Mark, expand: ExpandMark, ) -> Result<(), AutomergeError>
§fn unmark<O>(
&mut self,
obj: O,
key: &str,
start: usize,
end: usize,
expand: ExpandMark,
) -> Result<(), AutomergeError>
fn unmark<O>( &mut self, obj: O, key: &str, start: usize, end: usize, expand: ExpandMark, ) -> Result<(), AutomergeError>
§fn split_block<'p, O>(
&mut self,
obj: O,
index: usize,
) -> Result<ExId, AutomergeError>
fn split_block<'p, O>( &mut self, obj: O, index: usize, ) -> Result<ExId, AutomergeError>
obj at the given index. Read more§fn join_block<O>(&mut self, text: O, index: usize) -> Result<(), AutomergeError>
fn join_block<O>(&mut self, text: O, index: usize) -> Result<(), AutomergeError>
index from the text object obj.§fn replace_block<'p, O>(
&mut self,
text: O,
index: usize,
) -> Result<ExId, AutomergeError>
fn replace_block<'p, O>( &mut self, text: O, index: usize, ) -> Result<ExId, AutomergeError>
index in obj with a new marker and return the ID of the new
marker§fn base_heads(&self) -> Vec<ChangeHash>
fn base_heads(&self) -> Vec<ChangeHash>
§fn update_text<S>(
&mut self,
obj: &ExId,
new_text: S,
) -> Result<(), AutomergeError>
fn update_text<S>( &mut self, obj: &ExId, new_text: S, ) -> Result<(), AutomergeError>
§fn update_spans<O, I>(
&mut self,
text: O,
config: UpdateSpansConfig,
new_text: I,
) -> Result<(), AutomergeError>
fn update_spans<O, I>( &mut self, text: O, config: UpdateSpansConfig, new_text: I, ) -> Result<(), AutomergeError>
fn update_object<O>( &mut self, obj: O, new_value: &Value, ) -> Result<(), UpdateObjectError>
§fn batch_create_object<O, P>(
&mut self,
obj: O,
prop: P,
value: &Value,
insert: bool,
) -> Result<ExId, AutomergeError>
fn batch_create_object<O, P>( &mut self, obj: O, prop: P, value: &Value, insert: bool, ) -> Result<ExId, AutomergeError>
hydrate::Value as a new object tree using
batch operations. Read more§fn init_root_from_hydrate(&mut self, value: &Map) -> Result<(), AutomergeError>
fn init_root_from_hydrate(&mut self, value: &Map) -> Result<(), AutomergeError>
value Read moreAuto Trait Implementations§
impl Freeze for AutoCommit
impl RefUnwindSafe for AutoCommit
impl Send for AutoCommit
impl Sync for AutoCommit
impl Unpin for AutoCommit
impl UnsafeUnpin for AutoCommit
impl UnwindSafe for AutoCommit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ReadTyped for T
impl<T> ReadTyped for T
§fn int_at(&self, obj: &ExId, prop: impl Into<Prop>) -> Option<i64>
fn int_at(&self, obj: &ExId, prop: impl Into<Prop>) -> Option<i64>
prop of obj, when it fits an i64.§fn uint_at(&self, obj: &ExId, prop: impl Into<Prop>) -> Option<u64>
fn uint_at(&self, obj: &ExId, prop: impl Into<Prop>) -> Option<u64>
prop of obj, when it fits a u64.