pub struct Insert<F>(pub F);
Expand description
Layer that inserts a value into the env context
with a RefOperator
.
Tuple Fields§
§0: F
Trait Implementations§
source§impl<T, P, R, Out, F> Layer<T, P> for Insert<F>where
P: ContextOperator<T>,
R: for<'a> RefOperator<'a, T, Output = Out>,
Out: Send + Sync + 'static,
F: Fn() -> R,
impl<T, P, R, Out, F> Layer<T, P> for Insert<F>where P: ContextOperator<T>, R: for<'a> RefOperator<'a, T, Output = Out>, Out: Send + Sync + 'static, F: Fn() -> R,
Auto Trait Implementations§
impl<F> RefUnwindSafe for Insert<F>where F: RefUnwindSafe,
impl<F> Send for Insert<F>where F: Send,
impl<F> Sync for Insert<F>where F: Sync,
impl<F> Unpin for Insert<F>where F: Unpin,
impl<F> UnwindSafe for Insert<F>where F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<In, P, L> LayerExt<In, P> for Lwhere
P: ContextOperator<In>,
L: Layer<In, P>,
impl<In, P, L> LayerExt<In, P> for Lwhere P: ContextOperator<In>, L: Layer<In, P>,
source§fn boxed(self) -> BoxLayer<P, In, Self::Out>where
Self: Sized + Send + Sync + 'static,
Self::Operator: Send + 'static,
fn boxed(self) -> BoxLayer<P, In, Self::Out>where Self: Sized + Send + Sync + 'static, Self::Operator: Send + 'static,
Create a boxed
Layer
.source§fn with<Outer>(self, outer: Outer) -> Stack<Self, Outer>where
Outer: Layer<In, Self::Operator>,
Self: Sized,
fn with<Outer>(self, outer: Outer) -> Stack<Self, Outer>where Outer: Layer<In, Self::Operator>, Self: Sized,
Stack a outer layer on top of the inner layer.
source§fn insert_env<R, Out, F>(self, f: F) -> Stack<Self, Insert<F>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_env<R, Out, F>(self, f: F) -> Stack<Self, Insert<F>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = Out>, Out: Send + Sync + 'static, Self: Sized,
Add a
Insert
layer with the given RefOperator
constructor
(i.e. a function that returns a RefOperator
). Read moresource§fn insert_env_if<R, Out, F>(
self,
enable: bool,
f: F
) -> Stack<Self, OptionalLayer<Insert<F>>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_env_if<R, Out, F>( self, enable: bool, f: F ) -> Stack<Self, OptionalLayer<Insert<F>>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = Out>, Out: Send + Sync + 'static, Self: Sized,
source§fn insert_data<R, Out, F>(self, f: F) -> Stack<Self, InsertData<F>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_data<R, Out, F>(self, f: F) -> Stack<Self, InsertData<F>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = Option<Out>>, Out: Send + Sync + 'static, Self: Sized,
Add a
InsertData
layer with the given RefOperator
constructor.
(i.e. a function that returns a RefOperator
). Read moresource§fn insert_data_if<R, Out, F>(
self,
enable: bool,
f: F
) -> Stack<Self, OptionalLayer<InsertData<F>>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_data_if<R, Out, F>( self, enable: bool, f: F ) -> Stack<Self, OptionalLayer<InsertData<F>>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = Option<Out>>, Out: Send + Sync + 'static, Self: Sized,
source§fn insert<R, Env, Data, F>(self, f: F) -> Stack<Self, InsertWithData<F>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>,
Env: Send + Sync + 'static,
Data: Send + Sync + 'static,
Self: Sized,
fn insert<R, Env, Data, F>(self, f: F) -> Stack<Self, InsertWithData<F>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>, Env: Send + Sync + 'static, Data: Send + Sync + 'static, Self: Sized,
Add a
InsertWithData
layer with the given RefOperator
constructor.
(i.e. a function that returns a RefOperator
). Read moresource§fn insert_if<R, Env, Data, F>(
self,
enable: bool,
f: F
) -> Stack<Self, OptionalLayer<InsertWithData<F>>>where
F: Fn() -> R,
R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>,
Env: Send + Sync + 'static,
Data: Send + Sync + 'static,
Self: Sized,
fn insert_if<R, Env, Data, F>( self, enable: bool, f: F ) -> Stack<Self, OptionalLayer<InsertWithData<F>>>where F: Fn() -> R, R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>, Env: Send + Sync + 'static, Data: Send + Sync + 'static, Self: Sized,
source§fn inspect<F>(self, f: F) -> Stack<Self, Inspect<F>>where
F: Fn(&In, &Context) + Clone,
Self: Sized,
fn inspect<F>(self, f: F) -> Stack<Self, Inspect<F>>where F: Fn(&In, &Context) + Clone, Self: Sized,
Add an inspect layer with the given closure.
source§fn provide<D>(self, data: D) -> Stack<Self, AddData<D>>where
D: Clone + Send + Sync + 'static,
Self: Sized,
fn provide<D>(self, data: D) -> Stack<Self, AddData<D>>where D: Clone + Send + Sync + 'static, Self: Sized,
Provide data to the context.
source§fn provide_if<D>(
self,
data: Option<D>
) -> Stack<Self, OptionalLayer<AddData<D>>>where
D: Clone + Send + Sync + 'static,
Self: Sized,
fn provide_if<D>( self, data: Option<D> ) -> Stack<Self, OptionalLayer<AddData<D>>>where D: Clone + Send + Sync + 'static, Self: Sized,
Optionally provide data to the context. Read more
source§fn provide_with<D>(
self,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> Stack<Self, AddData<D>>where
D: Send + Sync + 'static,
Self: Sized,
fn provide_with<D>( self, provider: impl Fn() -> Option<D> + Send + Sync + 'static ) -> Stack<Self, AddData<D>>where D: Send + Sync + 'static, Self: Sized,
Provide data to the context with the given data provider.
source§fn provide_with_if<D>(
self,
enable: bool,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> Stack<Self, OptionalLayer<AddData<D>>>where
D: Send + Sync + 'static,
Self: Sized,
fn provide_with_if<D>( self, enable: bool, provider: impl Fn() -> Option<D> + Send + Sync + 'static ) -> Stack<Self, OptionalLayer<AddData<D>>>where D: Send + Sync + 'static, Self: Sized,
Optionally provide data to the context with the given data provider. Read more
source§fn from_context<D>(self) -> Stack<Self, AddData<D>>where
D: Send + Sync + 'static,
Self: Sized,
fn from_context<D>(self) -> Stack<Self, AddData<D>>where D: Send + Sync + 'static, Self: Sized,
👎Deprecated: use
data_from_context
insteadDeclare that the data of type
D
is in the context.source§fn data_from_context<D>(self) -> Stack<Self, AddData<D>>where
D: Send + Sync + 'static,
Self: Sized,
fn data_from_context<D>(self) -> Stack<Self, AddData<D>>where D: Send + Sync + 'static, Self: Sized,
Declare that the data of type
D
is in the data context.