multipart::server::save

Enum SaveResult

Source
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>>

Source

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>,

Source

pub fn okish(self) -> Option<S>

Convert self to Option<S>; there may still have been an error.

Source

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.

Source

pub fn into_opt_both(self) -> (Option<S>, Option<Error>)

Decompose self to (Option<S>, Option<io::Error>)

Source

pub fn into_result(self) -> Result<S>

Map self to an io::Result, discarding the error in the Partial case.

Source

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.

Trait Implementations§

Source§

impl<Success: Debug, Partial: Debug> Debug for SaveResult<Success, Partial>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Success, Partial> Freeze for SaveResult<Success, Partial>
where Success: Freeze, Partial: Freeze,

§

impl<Success, Partial> !RefUnwindSafe for SaveResult<Success, Partial>

§

impl<Success, Partial> Send for SaveResult<Success, Partial>
where Success: Send, Partial: Send,

§

impl<Success, Partial> Sync for SaveResult<Success, Partial>
where Success: Sync, Partial: Sync,

§

impl<Success, Partial> Unpin for SaveResult<Success, Partial>
where Success: Unpin, Partial: Unpin,

§

impl<Success, Partial> !UnwindSafe for SaveResult<Success, Partial>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V