pub struct EventNodeBuilder<A, F, M>where
A: EventArgs,{ /* private fields */ }Expand description
Helper for declaring event properties.
Implementations§
Source§impl<A, M> EventNodeBuilder<A, (), M>where
A: EventArgs,
impl<A, M> EventNodeBuilder<A, (), M>where
A: EventArgs,
Sourcepub fn filter<FB, F>(self, filter_builder: FB) -> EventNodeBuilder<A, FB, M>
pub fn filter<FB, F>(self, filter_builder: FB) -> EventNodeBuilder<A, FB, M>
Filter event.
The filter_builder is called on init and on event, it must produce another closure, the filter predicate. The filter_builder
runs in the widget context, the filter predicate does not always.
In the event hook the filter predicate runs in the app context, it is called if the args target the widget, the predicate must use any captured contextual info to filter the args, this is an optimization, it can save a visit to the widget node.
If the event is received the second filter predicate is called again to confirm the event.
The second instance is called if propagation was not stopped, if it returns true the handler closure is called.
Note that events that represent an interaction with the widget are send for both ENABLED and DISABLED targets,
event properties should probably distinguish if they fire on normal interactions vs on disabled interactions.
Source§impl<A, F> EventNodeBuilder<A, F, ()>where
A: EventArgs,
impl<A, F> EventNodeBuilder<A, F, ()>where
A: EventArgs,
Source§impl<A, F, FB, MA, M> EventNodeBuilder<A, FB, M>
Build with filter and args mapping.
impl<A, F, FB, MA, M> EventNodeBuilder<A, FB, M>
Build with filter and args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&MA) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&MA) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Source§impl<A, F, FB> EventNodeBuilder<A, FB, ()>
Build with filter and without args mapping.
impl<A, F, FB> EventNodeBuilder<A, FB, ()>
Build with filter and without args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&A) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&A) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Source§impl<A> EventNodeBuilder<A, (), ()>where
A: EventArgs,
Build without filter and without args mapping.
impl<A> EventNodeBuilder<A, (), ()>where
A: EventArgs,
Build without filter and without args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&A) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&A) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Source§impl<A, MA, M> EventNodeBuilder<A, (), M>
Build with no filter and args mapping.
impl<A, MA, M> EventNodeBuilder<A, (), M>
Build with no filter and args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&MA) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&MA) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Auto Trait Implementations§
impl<A, F, M> Freeze for EventNodeBuilder<A, F, M>
impl<A, F, M> RefUnwindSafe for EventNodeBuilder<A, F, M>where
F: RefUnwindSafe,
M: RefUnwindSafe,
impl<A, F, M> Send for EventNodeBuilder<A, F, M>
impl<A, F, M> Sync for EventNodeBuilder<A, F, M>
impl<A, F, M> Unpin for EventNodeBuilder<A, F, M>
impl<A, F, M> UnwindSafe for EventNodeBuilder<A, F, M>where
F: UnwindSafe,
M: 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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