pub enum SaveResult<Success, Partial> {
Full(Success),
Partial(Partial, PartialReason),
Error(Error),
}Expand description
The ternary result type used for the SaveBuilder<_> API.
Variants§
Full(Success)
The operation was a total success. Contained is the complete result.
Partial(Partial, PartialReason)
The operation quit partway through. Included is the partial result along with the reason.
Error(Error)
An error occurred at the start of the operation, before anything was done.
Implementations§
Source§impl<M: ReadEntry> SaveResult<Entries, PartialEntries<M>>
impl<M: ReadEntry> SaveResult<Entries, PartialEntries<M>>
Sourcepub fn into_entries(self) -> Option<Entries>
pub fn into_entries(self) -> Option<Entries>
Take the Entries from self, if applicable, and discarding
the error, if any.
Source§impl<S, P> SaveResult<S, P>where
P: Into<S>,
impl<S, P> SaveResult<S, P>where
P: Into<S>,
Sourcepub fn map<T, Map>(self, map: Map) -> SaveResult<T, T>where
Map: FnOnce(S) -> T,
pub fn map<T, Map>(self, map: Map) -> SaveResult<T, T>where
Map: FnOnce(S) -> T,
Map the Full or Partial values to a new type, retaining the reason
in the Partial case.
Sourcepub fn into_opt_both(self) -> (Option<S>, Option<Error>)
pub fn into_opt_both(self) -> (Option<S>, Option<Error>)
Decompose self to (Option<S>, Option<io::Error>)
Sourcepub fn into_result(self) -> Result<S>
pub fn into_result(self) -> Result<S>
Map self to an io::Result, discarding the error in the Partial case.
Sourcepub fn into_result_strict(self) -> Result<S>
pub fn into_result_strict(self) -> Result<S>
Pessimistic version of into_result() which will return an error even
for the Partial case.
§Note: Possible Storage Leak
It’s generally not a good idea to ignore the Partial case, as there may still be a
partially written file on-disk. If you’re not using a temporary directory
(OS-managed or via TempDir) then partially written files will remain on-disk until
explicitly removed which could result in excessive disk usage if not monitored closely.