Struct Edits
pub struct Edits<'a> { /* private fields */ }Expand description
The document as a host lends it to one pass that may change it: read freely, changed only through a typed action the action host applies (a resource’s dispatcher applies it), so every change is an action that is attributed, recorded in history and undone like any other. Direct CRDT mutation is rejected at the widget boundary:
use automerge::{ROOT, transaction::Transactable};
use tilo_ui::widget::Edits;
fn bypass(edits: &mut Edits<'_>) {
edits.put(ROOT, "bypass", true).unwrap();
}Implementations§
Methods from Deref<Target = AutoCommit>§
pub fn diff_opset(&self, other: &AutoCommit) -> Result<(), AutomergeError>
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 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 get_actor(&self) -> &ActorId
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 is_empty(&self) -> bool
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
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Edits<'a>
impl<'a> RefUnwindSafe for Edits<'a>
impl<'a> Send for Edits<'a>
impl<'a> Sync for Edits<'a>
impl<'a> Unpin for Edits<'a>
impl<'a> UnsafeUnpin for Edits<'a>
impl<'a> !UnwindSafe for Edits<'a>
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
§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