pub enum ApplyResult<V = Vec<u8, Global>> {
    NoValue,
    Value(V),
    Err(Error),
}
Expand description

Utility that impl’s try for both None and Err Semantically the None value means the caller has to decide whether to continue.

Variants§

§

NoValue

§

Value(V)

§

Err(Error)

Implementations§

source§

impl<V> ApplyResult<V>

source

pub fn map<X>(self, f: impl FnOnce(V) -> X) -> ApplyResult<X>

source

pub fn into_ok(self) -> Result<Option<V>, Error>

source

pub fn into_opt(self) -> Option<Result<V, Error>>

source

pub fn arg_err<X>( args: impl IntoIterator<Item = X>, expect: &str ) -> ApplyResult<V>where X: AsRef<[u8]>,

source

pub fn or_else(self, map: impl FnOnce() -> ApplyResult<V>) -> ApplyResult<V>

source

pub fn require(self, msg: &'static str) -> ApplyResult<V>

source

pub fn context<C>(self, context: C) -> ApplyResult<V>where C: Display + Send + Sync + 'static,

Trait Implementations§

source§

impl<V> Debug for ApplyResult<V>where V: Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<V, E> From<Option<Result<V, E>>> for ApplyResult<V>where E: Into<Error>,

source§

fn from(v: Option<Result<V, E>>) -> ApplyResult<V>

Converts to this type from the input type.
source§

impl<V> From<Option<V>> for ApplyResult<V>

source§

fn from(value: Option<V>) -> ApplyResult<V>

Converts to this type from the input type.
source§

impl<V> From<Result<V, Error>> for ApplyResult<V>

source§

fn from(v: Result<V, Error>) -> ApplyResult<V>

Converts to this type from the input type.
source§

impl<V> From<V> for ApplyResult<V>

source§

fn from(value: V) -> ApplyResult<V>

Converts to this type from the input type.
source§

impl<V> FromResidual<ApplyResult<V>> for ApplyResult<V>

source§

fn from_residual(residual: ApplyResult<V>) -> ApplyResult<V>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
source§

impl<V> FromResidual<Option<Infallible>> for ApplyResult<V>

source§

fn from_residual(_residual: Option<Infallible>) -> ApplyResult<V>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
source§

impl<V, E> FromResidual<Result<Infallible, E>> for ApplyResult<V>where E: Into<Error>,

source§

fn from_residual(residual: Result<Infallible, E>) -> ApplyResult<V>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
source§

impl<V> Try for ApplyResult<V>

§

type Output = V

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = ApplyResult<V>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more
source§

fn from_output(output: <ApplyResult<V> as Try>::Output) -> ApplyResult<V>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch( self ) -> ControlFlow<<ApplyResult<V> as Try>::Residual, <ApplyResult<V> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more

Auto Trait Implementations§

§

impl<V = Vec<u8, Global>> !RefUnwindSafe for ApplyResult<V>

§

impl<V> Send for ApplyResult<V>where V: Send,

§

impl<V> Sync for ApplyResult<V>where V: Sync,

§

impl<V> Unpin for ApplyResult<V>where V: Unpin,

§

impl<V = Vec<u8, Global>> !UnwindSafe for ApplyResult<V>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

const: unstable · source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.