pub struct ChangeWriter { /* private fields */ }Expand description
Builds the changes that write new content into one document. See the module docs.
Implementations§
Source§impl ChangeWriter
impl ChangeWriter
Sourcepub fn continuing(doc: &mut Doc) -> Option<Self>
pub fn continuing(doc: &mut Doc) -> Option<Self>
A writer continuing doc’s history as its actor: the open
transaction is committed first, and the changes this builds follow it.
None when the document can’t take changes written this way (a text
encoding other than code points, an actor whose last change is
unreadable); write op by op instead.
Sourcepub fn make_in(&mut self, obj: &ObjId, key: &str, kind: ObjType) -> Created
pub fn make_in(&mut self, obj: &ObjId, key: &str, kind: ObjType) -> Created
Create an object of kind under key of an object the document
already has.
Sourcepub fn make(&mut self, parent: &Created, key: &str, kind: ObjType) -> Created
pub fn make(&mut self, parent: &Created, key: &str, kind: ObjType) -> Created
Create an object of kind under key of an object this writer
created.
Sourcepub fn put(&mut self, parent: &Created, key: &str, value: ScalarValue)
pub fn put(&mut self, parent: &Created, key: &str, value: ScalarValue)
Put a scalar under key of an object this writer created.
Sourcepub fn text(
&mut self,
parent: &Created,
key: &str,
text: &str,
marks: &[TextMark],
)
pub fn text( &mut self, parent: &Created, key: &str, text: &str, marks: &[TextMark], )
Create a text object under key of an object this writer created,
holding text with marks applied: per mark, a begin anchor after
the character before its start (not expanding) and an end anchor after
the character before its end (expanding), which is where a local
ExpandMark::After mark puts them. Marks must be non-empty and within
the text.
Sourcepub fn apply(&mut self, doc: &mut Doc) -> Result<(), AutomergeError>
pub fn apply(&mut self, doc: &mut Doc) -> Result<(), AutomergeError>
Seal the change being built and apply it to doc, the document this
writer continues. Apply as soon as a change is big enough
(OPS_PER_CHANGE): Automerge expands a change’s ops in memory while
integrating it.
Auto Trait Implementations§
impl Forget for ChangeWriter
impl Freeze for ChangeWriter
impl Move for ChangeWriter
impl RefUnwindSafe for ChangeWriter
impl Send for ChangeWriter
impl Sync for ChangeWriter
impl Unpin for ChangeWriter
impl UnsafeUnpin for ChangeWriter
impl UnwindSafe for ChangeWriter
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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