pub struct Offsets { /* private fields */ }
Expand description
The offsets previous events cause on any future events which have not taken the previous ones into account.
Implementations§
source§impl Offsets
impl Offsets
sourcepub fn add_diff(&mut self, diff: &Difference, len_diff: isize)
pub fn add_diff(&mut self, diff: &Difference, len_diff: isize)
Add another diff to us.
len_diff
is the difference in length before and after applying diff
to your data, like
after - before
. Consider using utils::sub_usize
.
sourcepub fn apply_single(&self, diff: &mut Difference)
pub fn apply_single(&self, diff: &mut Difference)
Apply these offsets to a single diff
.
Use Self::apply
for a more convenient function.
sourcepub fn apply<'a>(self, events: impl Iterator<Item = &'a mut Event>)
pub fn apply<'a>(self, events: impl Iterator<Item = &'a mut Event>)
Apply the offsets on events
to adjust them to the events that have since changed
(Self::add_diff
).
Will set all the Event
s’ block_size
s to 1
.
events
should be an iterator over the Event
s with the relevant Event::resource
.
sourcepub fn transform_index(&self, index: usize) -> usize
pub fn transform_index(&self, index: usize) -> usize
Returns where index
is after the diffs we are tracking are applied.
This is provided on a best-effort basis, just like the rest of this struct.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Offsets
impl RefUnwindSafe for Offsets
impl Send for Offsets
impl Sync for Offsets
impl Unpin for Offsets
impl UnwindSafe for Offsets
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