Skip to main content

ScopedLayer

Struct ScopedLayer 

Source
pub struct ScopedLayer<L> { /* private fields */ }
Expand description

Transparent wrapper around a layer (identity Layer::build).

Trait Implementations§

Source§

impl<L> Layer for ScopedLayer<L>
where L: Layer,

Source§

type Output = <L as Layer>::Output

Value produced when Layer::build succeeds.
Source§

type Error = <L as Layer>::Error

Error type when Layer::build fails.
Source§

fn build(&self) -> Result<Self::Output, Self::Error>

Materializes this layer’s output (or error) synchronously.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<L> UnwindSafe for ScopedLayer<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> LayerExt for T
where T: Layer,

Source§

fn map<O2, F>(self, f: F) -> MapLayer<Self, F>
where F: Fn(Self::Output) -> O2 + Clone,

Maps successful output with f after Layer::build.
Source§

fn map_error<E2, F>(self, f: F) -> MapErrorLayer<Self, F>
where F: Fn(Self::Error) -> E2 + Clone,

Maps the error channel with f after Layer::build.
Source§

fn merge<L2>(self, that: L2) -> MergeLayer<Self, L2>
where L2: Layer<Error = Self::Error>,

Runs self and that and returns both outputs as a pair (fails on first error).
Source§

fn provide<L0>(self, that: L0) -> ProvideLayer<Self, L0>
where L0: Layer<Error = Self::Error>,

Runs that for side effects, discards its output, then runs self.
Source§

fn provide_merge<L0>(self, that: L0) -> ProvideMergeLayer<Self, L0>
where L0: Layer<Error = Self::Error>,

Runs that then self, returning (self_output, provider_output).
Source§

fn scoped(self) -> ScopedLayer<Self>

Marker wrapper; Layer::build delegates to the inner layer (for future scope/resource hooks).
Source§

fn launch(self) -> Effect<(), Self::Error, ()>
where Self: 'static, Self::Error: 'static, Self::Output: 'static,

Turns this layer into an Effect that runs Layer::build and discards the output.
Source§

fn pipe<O2, F>(self, f: F) -> O2
where F: FnOnce(Self) -> O2,

Feed self into a combinator (implemented with crate::foundation::func::pipe1).
Source§

fn and_then<B>(self, next: B) -> StackThen<Self, B>
where B: LayerFrom<Self::Output, Error = Self::Error>,

Dependent stack: run self, then next with a borrow of the first output. Equivalent to StackThen(self, next).
Source§

impl<T> Pipe for T

Source§

fn pipe<F, R>(self, f: F) -> R
where F: FnOnce(Self) -> R,

Applies f to self (F#-style forward pipe).
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.