Skip to main content

Verdict

Type Alias Verdict 

Source
pub type Verdict<T, W> = Result<Caveat<T, W>, ErrorSet<W>>;
Expand description

A Verdict is a standard Result with Warnings potentially issued for both the Ok and Err variants.

Aliased Type§

pub enum Verdict<T, W> {
    Ok(Caveat<T, W>),
    Err(ErrorSet<W>),
}

Variants§

§1.0.0

Ok(Caveat<T, W>)

Contains the success value

§1.0.0

Err(ErrorSet<W>)

Contains the error value

Trait Implementations§

Source§

impl<T, W> GatherWarnings<T, W> for Verdict<T, W>
where W: Warning,

Convert a Result<Caveat<T>> into Result<T> by gathering up its Warnings.

Source§

fn gather_warnings_into<WA>(self, warnings: &mut Set<WA>) -> Self::Output
where W: Into<WA>, WA: Warning,

Convert a Verdict into an Option by collecting Warnings from the Ok and Err variants and mapping Ok to Some and Err to None.

Source§

type Output = Result<T, ErrorSet<W>>

The output type of after all the warnings have been gathered.
Source§

impl<T, W: Warning> VerdictExt<T, W> for Verdict<T, W>

Source§

fn map_caveat<F, U>(self, op: F) -> Verdict<U, W>
where F: FnOnce(T) -> U,

Maps a Verdict<T, E> to Verdict<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.
Source§

fn only_error(self) -> Result<Caveat<T, W>, Error<W>>

Discard all warnings in the Err variant and keep only the warning that caused the error.