Trait indicator::context::ContextOperatorExt
source · pub trait ContextOperatorExt<In>: ContextOperator<In> {
Show 20 methods
// Provided methods
fn boxed(self) -> BoxContextOperator<In, Self::Out>
where Self: Send + Sized + 'static { ... }
fn with<L>(self, layer: L) -> L::Operator
where L: Layer<In, Self>,
Self: Sized { ... }
fn finish(self) -> ContextedOperator<Self>
where Self: Sized { ... }
fn finish_with_data(self, data: Map) -> ContextedOperator<Self>
where Self: Sized { ... }
fn cache(self, length: usize) -> CacheOperator<Self>
where Self: Sized { ... }
fn insert_env<R, Out>(self, f: impl Fn() -> R) -> InsertOperator<Self, R>
where R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized { ... }
fn insert_env_if<R, Out>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertOperator<Self, R>, Self>
where R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized { ... }
fn insert_data<R, Out>(
self,
f: impl Fn() -> R
) -> InsertDataOperator<Self, R>
where R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized { ... }
fn insert_data_if<R, Out>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertDataOperator<Self, R>, Self>
where R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized { ... }
fn insert<R, Env, Data>(
self,
f: impl Fn() -> R
) -> InsertWithDataOperator<Self, R>
where 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>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertWithDataOperator<Self, R>, Self>
where R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>,
Env: Send + Sync + 'static,
Data: Send + Sync + 'static,
Self: Sized { ... }
fn inspect<F>(self, f: F) -> InspectOperator<Self, F>
where F: Fn(&In, &Context) + Clone,
Self: Sized { ... }
fn provide<D>(self, data: D) -> AddDataOperator<D, Self>
where D: Clone + Send + Sync + 'static,
Self: Sized { ... }
fn provide_if<D>(
self,
data: Option<D>
) -> Either<AddDataOperator<D, Self>, Self>
where D: Clone + Send + Sync + 'static,
Self: Sized { ... }
fn provide_with<D>(
self,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> AddDataOperator<D, Self>
where D: Send + Sync + 'static,
Self: Sized { ... }
fn provide_with_if<D>(
self,
enable: bool,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> Either<AddDataOperator<D, Self>, Self>
where D: Send + Sync + 'static,
Self: Sized { ... }
fn from_context<D>(self) -> AddDataOperator<D, Self>
where D: Send + Sync + 'static,
Self: Sized { ... }
fn data_from_context<D>(self) -> AddDataOperator<D, Self>
where D: Send + Sync + 'static,
Self: Sized { ... }
fn then_with<Out, F, Builder>(
self,
builder: Builder
) -> ThenOperator<Self, F>
where F: FnMut(Self::Out, &Context) -> Out + Clone,
Builder: Fn() -> F,
Self: Sized { ... }
fn with_if<L>(self, layer: Option<L>) -> Either<L::Operator, Self>
where L: Layer<In, Self>,
L::Operator: ContextOperator<In, Out = Self::Out>,
Self: Sized { ... }
}
Expand description
Extension trait for ContextOperator
.
Provided Methods§
sourcefn boxed(self) -> BoxContextOperator<In, Self::Out>where
Self: Send + Sized + 'static,
fn boxed(self) -> BoxContextOperator<In, Self::Out>where Self: Send + Sized + 'static,
Create a boxed ContextOperator
.
sourcefn finish(self) -> ContextedOperator<Self>where
Self: Sized,
fn finish(self) -> ContextedOperator<Self>where Self: Sized,
Build into an operator without the Value
wrapper.
sourcefn finish_with_data(self, data: Map) -> ContextedOperator<Self>where
Self: Sized,
fn finish_with_data(self, data: Map) -> ContextedOperator<Self>where Self: Sized,
Build into an operator without the Value
wrapper with the given data context.
sourcefn cache(self, length: usize) -> CacheOperator<Self>where
Self: Sized,
fn cache(self, length: usize) -> CacheOperator<Self>where Self: Sized,
sourcefn insert_env<R, Out>(self, f: impl Fn() -> R) -> InsertOperator<Self, R>where
R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_env<R, Out>(self, f: impl Fn() -> R) -> InsertOperator<Self, R>where 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
).
We use this method to add the output of the operator to the env
context.
sourcefn insert_env_if<R, Out>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertOperator<Self, R>, Self>where
R: for<'a> RefOperator<'a, In, Output = Out>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_env_if<R, Out>( self, enable: bool, f: impl Fn() -> R ) -> Either<InsertOperator<Self, R>, Self>where R: for<'a> RefOperator<'a, In, Output = Out>, Out: Send + Sync + 'static, Self: Sized,
Optionally add a Insert
layer with the given RefOperator
constructor.
See [insert_env
] for more details.
sourcefn insert_data<R, Out>(self, f: impl Fn() -> R) -> InsertDataOperator<Self, R>where
R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_data<R, Out>(self, f: impl Fn() -> R) -> InsertDataOperator<Self, R>where 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
).
We use this method to add the output of the operator to the data
context.
sourcefn insert_data_if<R, Out>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertDataOperator<Self, R>, Self>where
R: for<'a> RefOperator<'a, In, Output = Option<Out>>,
Out: Send + Sync + 'static,
Self: Sized,
fn insert_data_if<R, Out>( self, enable: bool, f: impl Fn() -> R ) -> Either<InsertDataOperator<Self, R>, Self>where R: for<'a> RefOperator<'a, In, Output = Option<Out>>, Out: Send + Sync + 'static, Self: Sized,
Optionally add a InsertData
layer with the given RefOperator
constructor.
See [insert_data
] for more details.
sourcefn insert<R, Env, Data>(
self,
f: impl Fn() -> R
) -> InsertWithDataOperator<Self, R>where
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>( self, f: impl Fn() -> R ) -> InsertWithDataOperator<Self, R>where 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
).
We use this method to add the output of the operator to the env
and data
context simultaneously.
sourcefn insert_if<R, Env, Data>(
self,
enable: bool,
f: impl Fn() -> R
) -> Either<InsertWithDataOperator<Self, R>, Self>where
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>( self, enable: bool, f: impl Fn() -> R ) -> Either<InsertWithDataOperator<Self, R>, Self>where R: for<'a> RefOperator<'a, In, Output = (Env, Option<Data>)>, Env: Send + Sync + 'static, Data: Send + Sync + 'static, Self: Sized,
Optionally add a InsertWithData
layer with the given RefOperator
constructor.
See [insert
] for more details.
sourcefn inspect<F>(self, f: F) -> InspectOperator<Self, F>where
F: Fn(&In, &Context) + Clone,
Self: Sized,
fn inspect<F>(self, f: F) -> InspectOperator<Self, F>where F: Fn(&In, &Context) + Clone, Self: Sized,
Add an inspect layer with the given closure.
sourcefn provide<D>(self, data: D) -> AddDataOperator<D, Self>where
D: Clone + Send + Sync + 'static,
Self: Sized,
fn provide<D>(self, data: D) -> AddDataOperator<D, Self>where D: Clone + Send + Sync + 'static, Self: Sized,
Provide data to the context.
sourcefn provide_if<D>(
self,
data: Option<D>
) -> Either<AddDataOperator<D, Self>, Self>where
D: Clone + Send + Sync + 'static,
Self: Sized,
fn provide_if<D>( self, data: Option<D> ) -> Either<AddDataOperator<D, Self>, Self>where D: Clone + Send + Sync + 'static, Self: Sized,
Optionally provide data to the context.
If data is None
, the layer will be skipped,
so it won’t panic if the data is not in the context.
sourcefn provide_with<D>(
self,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> AddDataOperator<D, Self>where
D: Send + Sync + 'static,
Self: Sized,
fn provide_with<D>( self, provider: impl Fn() -> Option<D> + Send + Sync + 'static ) -> AddDataOperator<D, Self>where D: Send + Sync + 'static, Self: Sized,
Provide data to the context with the given data provider.
sourcefn provide_with_if<D>(
self,
enable: bool,
provider: impl Fn() -> Option<D> + Send + Sync + 'static
) -> Either<AddDataOperator<D, Self>, Self>where
D: Send + Sync + 'static,
Self: Sized,
fn provide_with_if<D>( self, enable: bool, provider: impl Fn() -> Option<D> + Send + Sync + 'static ) -> Either<AddDataOperator<D, Self>, Self>where D: Send + Sync + 'static, Self: Sized,
Optionally provide data to the context with the given data provider.
If not enabled, the layer will be skipped, so it will not panic if the data is not in the context.
sourcefn from_context<D>(self) -> AddDataOperator<D, Self>where
D: Send + Sync + 'static,
Self: Sized,
fn from_context<D>(self) -> AddDataOperator<D, Self>where D: Send + Sync + 'static, Self: Sized,
data_from_context
insteadDeclare that the data of type D
is in the context.
sourcefn data_from_context<D>(self) -> AddDataOperator<D, Self>where
D: Send + Sync + 'static,
Self: Sized,
fn data_from_context<D>(self) -> AddDataOperator<D, Self>where D: Send + Sync + 'static, Self: Sized,
Declare that the data of type D
is in the data context.