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§

source

fn boxed(self) -> BoxContextOperator<In, Self::Out>where Self: Send + Sized + 'static,

Create a boxed ContextOperator.

source

fn with<L>(self, layer: L) -> L::Operatorwhere L: Layer<In, Self>, Self: Sized,

Add a layer.

source

fn finish(self) -> ContextedOperator<Self>where Self: Sized,

Build into an operator without the Value wrapper.

source

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.

source

fn cache(self, length: usize) -> CacheOperator<Self>where Self: Sized,

Add a cache layer with the given length.

Panic

Panic if the length is 0.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

fn provide<D>(self, data: D) -> AddDataOperator<D, Self>where D: Clone + Send + Sync + 'static, Self: Sized,

Provide data to the context.

source

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.

source

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.

source

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.

source

fn from_context<D>(self) -> AddDataOperator<D, Self>where D: Send + Sync + 'static, Self: Sized,

👎Deprecated: use data_from_context instead

Declare that the data of type D is in the context.

source

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.

source

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,

Add a closure that will be called when the inner operator is evaluated.

source

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,

Optionally add a layer.

Implementors§

source§

impl<T, P> ContextOperatorExt<T> for Pwhere P: ContextOperator<T>,