pub struct Rewinder<'a> { /* private fields */ }
Expand description
Struct to apply all the diffs from a specified timestamp to a resource.
See Manager::rewind_from_last_commit
for more info.
Implementations§
source§impl<'a> Rewinder<'a>
impl<'a> Rewinder<'a>
sourcepub fn rewind_with_modify_diff(
&mut self,
resource: &str,
data: impl Into<Vec<u8>>,
diff_modification: impl FnMut(&Difference) -> Cow<'_, Difference>
) -> Result<Vec<u8>, RewindError>
pub fn rewind_with_modify_diff( &mut self, resource: &str, data: impl Into<Vec<u8>>, diff_modification: impl FnMut(&Difference) -> Cow<'_, Difference> ) -> Result<Vec<u8>, RewindError>
Rewinds the resource
back up to the most recent version.
diff_modification
can be used to change the diff just before it’s applied.
Errors
Passes errors from Difference::apply
.
sourcepub fn rewind(
&mut self,
resource: &str,
data: impl Into<Vec<u8>>
) -> Result<Vec<u8>, RewindError>
pub fn rewind( &mut self, resource: &str, data: impl Into<Vec<u8>> ) -> Result<Vec<u8>, RewindError>
Rewinds the resource
back up to the most recent version.
Errors
Passes errors from Difference::apply
.
sourcepub fn events(&self) -> impl Iterator<Item = &Event> + DoubleEndedIterator + '_
pub fn events(&self) -> impl Iterator<Item = &Event> + DoubleEndedIterator + '_
Get an iterator over the events stored in this rewinder. The first item is the oldest one. The last is the most recent.