Skip to main content

ViewScope

Struct ViewScope 

Source
pub struct ViewScope<In, Out, V: View<Out>, PrevChain, InnerSteps> { /* private fields */ }
Expand description

Builder for steps inside a .view::<V>() scope.

V is the view marker (implements View<Out>). Steps resolve against V::StaticViewType via IntoRefStep.

Implementations§

Source§

impl<In, Out, V: View<Out>, PrevChain, InnerSteps> ViewScope<In, Out, V, PrevChain, InnerSteps>

Source

pub fn tap<Params, S: IntoRefStep<V::StaticViewType, (), Params>>( self, f: S, registry: &Registry, ) -> ViewScope<In, Out, V, PrevChain, (InnerSteps, ViewTap<S::Step>)>

Observe the view. Side effects via Res/ResMut. Step signature: fn(Params..., &ViewType) -> ().

Source

pub fn inspect<S: IntoRefStep<V::StaticViewType, (), ()>>( self, f: S, registry: &Registry, ) -> ViewScope<In, Out, V, PrevChain, (InnerSteps, ViewTap<S::Step>)>

Observe the view without side effects (no Params). Step signature: fn(&ViewType).

Source

pub fn filter<Params, S: IntoRefStep<V::StaticViewType, bool, Params>>( self, f: S, registry: &Registry, ) -> ViewScope<In, Out, V, PrevChain, (InnerSteps, ViewGuard<S::Step>)>

Filter the event based on the view. Same as guard — returns bool to accept/reject. Step signature: fn(Params..., &ViewType) -> bool.

Source

pub fn guard<Params, S: IntoRefStep<V::StaticViewType, bool, Params>>( self, f: S, registry: &Registry, ) -> ViewScope<In, Out, V, PrevChain, (InnerSteps, ViewGuard<S::Step>)>

Guard the event based on the view. Step signature: fn(Params..., &ViewType) -> bool.

Source§

impl<In, Out, V, PrevChain, InnerSteps> ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: ChainCall<In, Out = Out>, V: View<Out>, InnerSteps: ViewSteps<V::StaticViewType>,

Source

pub fn end_view( self, ) -> PipelineChain<In, Out, ViewNode<PrevChain, InnerSteps, V>>

Close the view scope. The event passes through unchanged.

Source

pub fn end_view_guarded( self, ) -> PipelineChain<In, Option<Out>, ViewGuardedNode<PrevChain, InnerSteps, V>>

Close the view scope. If any guard rejected, returns None.

Source§

impl<In, Out, V, PrevChain, InnerSteps> ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: ChainCall<In, Out = Out>, V: View<Out>, InnerSteps: ViewSteps<V::StaticViewType>, Out: 'static,

Source

pub fn end_view_dag( self, ) -> DagChain<In, Out, ViewNode<PrevChain, InnerSteps, V>>

Close the view scope, returning a DagChain.

Source

pub fn end_view_dag_guarded( self, ) -> DagChain<In, Option<Out>, ViewGuardedNode<PrevChain, InnerSteps, V>>

Close a guarded view scope, returning a DagChain.

Source

pub fn end_view_arm(self) -> DagArm<In, Out, ViewNode<PrevChain, InnerSteps, V>>

Close the view scope, returning a DagArm.

Source

pub fn end_view_arm_guarded( self, ) -> DagArm<In, Option<Out>, ViewGuardedNode<PrevChain, InnerSteps, V>>

Close a guarded view scope, returning a DagArm.

Auto Trait Implementations§

§

impl<In, Out, V, PrevChain, InnerSteps> Freeze for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: Freeze, InnerSteps: Freeze,

§

impl<In, Out, V, PrevChain, InnerSteps> RefUnwindSafe for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: RefUnwindSafe, InnerSteps: RefUnwindSafe, V: RefUnwindSafe,

§

impl<In, Out, V, PrevChain, InnerSteps> Send for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: Send, InnerSteps: Send, V: Send,

§

impl<In, Out, V, PrevChain, InnerSteps> Sync for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: Sync, InnerSteps: Sync, V: Sync,

§

impl<In, Out, V, PrevChain, InnerSteps> Unpin for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: Unpin, InnerSteps: Unpin, V: Unpin,

§

impl<In, Out, V, PrevChain, InnerSteps> UnsafeUnpin for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: UnsafeUnpin, InnerSteps: UnsafeUnpin,

§

impl<In, Out, V, PrevChain, InnerSteps> UnwindSafe for ViewScope<In, Out, V, PrevChain, InnerSteps>
where PrevChain: UnwindSafe, InnerSteps: UnwindSafe, V: 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, 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.