Enum w_result::WResult [] [src]

#[must_use]
pub enum WResult<T, W, E> { WOk(T, Vec<W>), WErr(E), }

A result type that carries warnings.

Variants

Contains the success value along with any accumulated warnings.

Contains the error value.

Methods

impl<T, W, E> WResult<T, W, E>
[src]

Returns true if this WResult is WOk

Returns true if this WResult is WErr

Returns true if this WResult is WErr or if it is WOk but contains warnings.

Converts this WResult to an Option by taking the taking the WOk value or mapping WErr to None. Any warnings are discarded.

Converts this WResult to an Option by taking the WErr variant or mapping WOk to None.

Converts this WResult to an Option by taking the WOk variant or mapping WErr to None. This function is similar to ok_discard except if there are any warnings then they are treated as errors and this function returns None.

Map the WOk value of this WResult, if any.

Map the WErr value of this WResult, if any.

Map the warnings of this WResult.

If self is WOk, returns res with the warnings from self accumulated into the final result. Otherwise returns the WErr value of self.

If self is WOk, returns the result of applying op to self's value and warnings. Otherwise returns the WErr value of self.

If self is WOk returns self. Otherwise returns res.

If self is WOk returns self. Otherwise returns the result of applying op to self's error value.

Convert this WResult<T, W, E> to a Result<T, E>, discarding any errors. See also result_log for a version of this function that logs warnings.

Convert this WResult<T, W, E> to a Result<T, Result<W, E>>. This is a way to convert from WResult to Result, treating warnings as errors but allowing W and E to be two different types. See also result_werr for when W and E are the same type. If there are multiple warnings the first is returned.

If self is WOk, unwraps it discarding any warnings. Otherwise returns optb. See also unwrap_log_or for a version of this function that logs warnings.

If self is WOk and has no warnings, unwraps it. Otherwise returns optb.

If self is WOk, unwraps it discarding any warnings. Otherwise returns the result of applying op to self's error value. See also unwrap_log_or_else for a version of this function that logs warnings.

impl<T, E> WResult<T, E, E>
[src]

Take the error value of this WResult, if any. Otherwise returns the first warning, if any. This function is the same as WResult::err except that warnings are treated as errors.

Convert this WResult to a Result but treat warnings as errors. If there are multiple warnings the first is returned.

If self is WOk and has no warnings then unwrap it. Otherwise return the result of applying op to self's error or first warning.

impl<T, W, E> WResult<T, W, E> where
    W: Display
[src]

Take the WOk value of self, if any. Warnings are logged using the warn! macro before being discarded.

Convert this WResult<T, W, E> to a Result<T, E>. Warnings are logged using the warn! macro before being discarded.

If self is WOk, unwrap it and log any warnings using the warn! macro. Otherwise return optb.

If self is WOk, unwrap it and log any warnings using the warn! macro. Otherwise return the result of applying op to self's error value.

Trait Implementations

impl<T: PartialEq, W: PartialEq, E: PartialEq> PartialEq for WResult<T, W, E>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq, W: Eq, E: Eq> Eq for WResult<T, W, E>
[src]

impl<T: Hash, W: Hash, E: Hash> Hash for WResult<T, W, E>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Clone, W: Clone, E: Clone> Clone for WResult<T, W, E>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug, W: Debug, E: Debug> Debug for WResult<T, W, E>
[src]

Formats the value using the given formatter.

impl<T, W, E> From<Result<T, E>> for WResult<T, W, E>
[src]

Performs the conversion.

impl<A, T, W, E> FromIterator<WResult<A, W, E>> for WResult<T, W, E> where
    T: FromIterator<A>, 
[src]

Creates a value from an iterator. Read more