Skip to main content

Eh

Struct Eh 

Source
pub struct Eh<L: Loss> { /* private fields */ }
Expand description

Terni-functor composition context.

Accumulates loss across a sequence of Imperfect operations, converting each to Result for use with ?.

Call .finish() to wrap the final value with accumulated loss.

Implementations§

Source§

impl<L: Loss> Eh<L>

Source

pub fn new() -> Self

Create a new composition context with zero accumulated loss.

Source

pub fn eh<T, E>(&mut self, imp: Imperfect<T, E, L>) -> Result<T, E>

Extract value from Imperfect, accumulating loss. Returns Result<T, E> for use with ?.

Source

pub fn imp<T, E>(&mut self, imp: Imperfect<T, E, L>) -> Result<T, E>

Alias for eh. The name. For the mischievous ones.

Source

pub fn tri<T, E>(&mut self, imp: Imperfect<T, E, L>) -> Result<T, E>

Alias for eh.

Source

pub fn finish<T, E>(self, value: T) -> Imperfect<T, E, L>

Wrap a final value with accumulated loss. Success if no loss accumulated. Partial if any did.

Source

pub fn loss(&self) -> Option<&L>

Inspect accumulated loss without consuming the context.

Trait Implementations§

Source§

impl<L: Loss> Default for Eh<L>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<L> Freeze for Eh<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for Eh<L>
where L: RefUnwindSafe,

§

impl<L> Send for Eh<L>
where L: Send,

§

impl<L> Sync for Eh<L>
where L: Sync,

§

impl<L> Unpin for Eh<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for Eh<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for Eh<L>
where L: UnwindSafe,

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.