pub struct Operation(/* private fields */);
Expand description
A wrapper struct for any supported operation log version.
This struct should be preferred over any specific log version.
Implementations§
source§impl Operation
impl Operation
sourcepub fn require_latest_version(&self) -> Result<(), Error>
pub fn require_latest_version(&self) -> Result<(), Error>
Return an error if this Operation
is not the most recent schema version.
Errors
Error::UpgradeRequired
if this Operation
is not the most recent schema.
sourcepub fn as_latest_version(&self) -> Result<&Self, Error>
pub fn as_latest_version(&self) -> Result<&Self, Error>
Borrows the Operation
if it is the most recent schema version, otherwise returns an error.
Errors
Error::UpgradeRequired
if this Operation
is not the most recent schema.
sourcepub fn into_latest_version(self) -> Result<Self, Error>
pub fn into_latest_version(self) -> Result<Self, Error>
Returns the owned Operation
if it is the most recent schema version, otherwise returns an error.
Errors
Error::UpgradeRequired
if this Operation
is not the most recent schema.
sourcepub async fn latest_local(
hoard: &HoardName,
file: Option<(&PileName, &RelativePath)>
) -> Result<Option<Self>, Error>
pub async fn latest_local( hoard: &HoardName, file: Option<(&PileName, &RelativePath)> ) -> Result<Option<Self>, Error>
Returns the latest operation recorded on this machine (by UUID).
file
, if provided, must be a path relative to the root of one of the Hoard’s Piles.
Errors
- Any errors that occur while reading from the filesystem
- Any parsing errors from
serde_json
when parsing the file
Trait Implementations§
source§impl Checker for Operation
impl Checker for Operation
source§fn new<'life0, 'life1, 'life2, 'async_trait>(
hoards_root: &'life0 HoardPath,
name: &'life1 HoardName,
hoard: &'life2 Hoard,
direction: Direction
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn new<'life0, 'life1, 'life2, 'async_trait>( hoards_root: &'life0 HoardPath, name: &'life1 HoardName, hoard: &'life2 Hoard, direction: Direction ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Returns a new instance of the implementing Checker type. Read more
source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl OperationImpl for Operation
impl OperationImpl for Operation
source§fn contains_file(
&self,
pile_name: &PileName,
rel_path: &RelativePath,
only_modified: bool
) -> bool
fn contains_file( &self, pile_name: &PileName, rel_path: &RelativePath, only_modified: bool ) -> bool
Whether the operation log contains the given file by pile name and relative path.
source§fn timestamp(&self) -> OffsetDateTime
fn timestamp(&self) -> OffsetDateTime
The timestamp for the logged operation.
source§fn hoard_name(&self) -> &HoardName
fn hoard_name(&self) -> &HoardName
The associated hoard name for this operation.
source§fn checksum_for(
&self,
pile_name: &PileName,
rel_path: &RelativePath
) -> Option<Checksum>
fn checksum_for( &self, pile_name: &PileName, rel_path: &RelativePath ) -> Option<Checksum>
The checksum associated with the given file, or
None
if the file does not exist or was
deleted.source§fn all_files_with_checksums<'a>(
&'a self
) -> Box<dyn Iterator<Item = OperationFileInfo> + 'a>
fn all_files_with_checksums<'a>( &'a self ) -> Box<dyn Iterator<Item = OperationFileInfo> + 'a>
An iterator over all files that exist within this operation log, not including any that
were deleted.
source§fn hoard_operations_iter<'a>(
&'a self,
hoard_root: &HoardPath,
hoard: &Hoard
) -> Result<Box<dyn Iterator<Item = ItemOperation<HoardItem>> + 'a>, Error>
fn hoard_operations_iter<'a>( &'a self, hoard_root: &HoardPath, hoard: &Hoard ) -> Result<Box<dyn Iterator<Item = ItemOperation<HoardItem>> + 'a>, Error>
Returns an iterator of the file operations represented by this operation object. Read more
source§fn file_operation(
&self,
pile_name: &PileName,
rel_path: &RelativePath
) -> Result<Option<OperationType>, Error>
fn file_operation( &self, pile_name: &PileName, rel_path: &RelativePath ) -> Result<Option<OperationType>, Error>
Returns the operation performed on the given file, if any. Read more
source§impl PartialEq for Operation
impl PartialEq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
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
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.