Struct Inspect

Source
pub struct Inspect<F>(pub F);
Expand description

Layer that used to inspect the context.

Tuple Fields§

§0: F

Trait Implementations§

Source§

impl<T, P, F> Layer<T, P> for Inspect<F>
where P: ContextOperator<T>, F: Fn(&T, &Context) + Clone,

Source§

type Operator = InspectOperator<P, F>

The output operator.
Source§

type Out = <P as ContextOperator<T>>::Out

The output type.
Source§

fn layer(&self, operator: P) -> Self::Operator

Convert an In-operator to another In-operator.

Auto Trait Implementations§

§

impl<F> Freeze for Inspect<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for Inspect<F>
where F: RefUnwindSafe,

§

impl<F> Send for Inspect<F>
where F: Send,

§

impl<F> Sync for Inspect<F>
where F: Sync,

§

impl<F> Unpin for Inspect<F>
where F: Unpin,

§

impl<F> UnwindSafe for Inspect<F>
where F: 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<In, P, L> LayerExt<In, P> for L
where 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,

Create a boxed Layer.
Source§

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,

Add a Insert layer with the given RefOperator constructor (i.e. a function that returns a RefOperator). Read more
Source§

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,

Optionally add the Insert layer with the given RefOperator constructor. Read more
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,

Add a InsertData layer with the given RefOperator constructor. (i.e. a function that returns a RefOperator). Read more
Source§

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,

Optionally add the InsertData layer with the given RefOperator constructor. Read more
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,

Add a InsertWithData layer with the given RefOperator constructor. (i.e. a function that returns a RefOperator). Read more
Source§

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,

Optionally add the InsertWithData layer with the given RefOperator constructor. Read more
Source§

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,

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,

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,

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,

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,

👎Deprecated: use data_from_context instead
Declare 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,

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

fn then_with<Out, F, Builder>( self, builder: Builder, ) -> Stack<Self, Then<Builder>>
where Builder: Fn() -> F, F: FnMut(Self::Out, &Context) -> Out + Clone, Self: Sized,

Add a closure that will be called after the operator is evaluated.
Source§

fn with_if<L>(self, layer: Option<L>) -> Stack<Self, OptionalLayer<L>>
where L: Layer<In, Self::Operator>, L::Operator: ContextOperator<In, Out = Self::Out>, Self: Sized,

Optionally add a layer.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.