pub struct Tracker { /* private fields */ }Expand description
Produces the Delta of one live document between successive reads,
from the operations of the changes that arrived in between: its cost
follows the change, however large the document.
Implementations§
Source§impl Tracker
impl Tracker
pub fn new() -> Self
Sourcepub fn start(&mut self, doc: &mut Doc)
pub fn start(&mut self, doc: &mut Doc)
Start tracking from the document as it stands, for a state that was just read from it.
Sourcepub fn at(heads: Vec<ChangeHash>) -> Self
pub fn at(heads: Vec<ChangeHash>) -> Self
Track a document from heads, the version a state was read at.
Sourcepub fn heads(&self) -> Option<&[ChangeHash]>
pub fn heads(&self) -> Option<&[ChangeHash]>
The heads the last delta ended at.
Sourcepub fn leads_to(&self, doc: &Doc) -> bool
pub fn leads_to(&self, doc: &Doc) -> bool
Whether doc holds every change this tracker last saw: what moved
since is a delta of it, not another document.
Sourcepub fn delta(&mut self, doc: &mut Doc) -> Delta
pub fn delta(&mut self, doc: &mut Doc) -> Delta
What changed since the previous call (or Self::start). The first
call of a tracker that was not started is Delta::everything.
Sourcepub fn delta_located(
&mut self,
doc: &mut Doc,
locate: &dyn Fn(&ObjId) -> Option<ObjPath>,
) -> Delta
pub fn delta_located( &mut self, doc: &mut Doc, locate: &dyn Fn(&ObjId) -> Option<ObjPath>, ) -> Delta
Self::delta, with locate answering where objects the state
already knows sit, so the document is not asked.
Sourcepub fn committed_delta_located(
&mut self,
doc: &Doc,
locate: &dyn Fn(&ObjId) -> Option<ObjPath>,
) -> Delta
pub fn committed_delta_located( &mut self, doc: &Doc, locate: &dyn Fn(&ObjId) -> Option<ObjPath>, ) -> Delta
Self::delta_located up to the committed document, read through a
shared reference: edits of a transaction still open come with the
delta after it closes.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Tracker
impl Freeze for Tracker
impl Move for Tracker
impl RefUnwindSafe for Tracker
impl Send for Tracker
impl Sync for Tracker
impl Unpin for Tracker
impl UnsafeUnpin for Tracker
impl UnwindSafe for Tracker
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