Struct DocumentReplica
pub struct DocumentReplica { /* private fields */ }Expand description
A CRDT document paired with the explicit frontier for one collaboration
route. This is the small, undo-free replica used by metadata documents such
as room indexes; application documents add history through State.
Implementations§
§impl DocumentReplica
impl DocumentReplica
pub fn new(doc: AutoCommit) -> DocumentReplica
pub fn document(&self) -> &AutoCommit
pub fn document_mut(&mut self) -> &mut AutoCommit
pub fn pending_outbound_delta(&mut self) -> (Vec<u8>, Vec<ChangeHash>)
pub fn advance_outbound(&mut self, heads: Vec<ChangeHash>)
pub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
pub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
Apply incremental Automerge bytes and retain them in the outbound frontier.
§Errors
Returns an error when data is not a valid incremental Automerge payload
for this document.
pub fn merge_snapshot(&mut self, data: &[u8]) -> Result<(), AutomergeError>
pub fn merge_snapshot(&mut self, data: &[u8]) -> Result<(), AutomergeError>
Merge a complete Automerge snapshot and retain its observed frontier.
§Errors
Returns an error when data is not a valid Automerge snapshot or cannot
be merged into this document.
Auto Trait Implementations§
impl Freeze for DocumentReplica
impl RefUnwindSafe for DocumentReplica
impl Send for DocumentReplica
impl Sync for DocumentReplica
impl Unpin for DocumentReplica
impl UnsafeUnpin for DocumentReplica
impl UnwindSafe for DocumentReplica
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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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>
Converts
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>
Converts
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