pub struct VarEventNodeBuilder<I, F, M> { /* private fields */ }Expand description
Helper for declaring event properties from variables.
Implementations§
Source§impl<I, T> VarEventNodeBuilder<I, (), ()>
impl<I, T> VarEventNodeBuilder<I, (), ()>
Sourcepub fn new(init_var: I) -> VarEventNodeBuilder<I, (), ()>
pub fn new(init_var: I) -> VarEventNodeBuilder<I, (), ()>
Node that calls the handler for var updates.
The init_var is called on init to
Source§impl<T, I, M> VarEventNodeBuilder<I, (), M>
impl<T, I, M> VarEventNodeBuilder<I, (), M>
Sourcepub fn filter<FB, F>(self, filter_builder: FB) -> VarEventNodeBuilder<I, FB, M>
pub fn filter<FB, F>(self, filter_builder: FB) -> VarEventNodeBuilder<I, FB, M>
Filter event.
The filter_builder is called on init and on new, it must produce another closure, the filter predicate. The filter_builder
runs in the widget context, the filter predicate does not always.
In the variable 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 update is received the second filter predicate is called again to confirm the update.
If it returns true the handler closure is called.
Source§impl<T, I, F> VarEventNodeBuilder<I, F, ()>
impl<T, I, F> VarEventNodeBuilder<I, F, ()>
Sourcepub fn map_args<M, MA>(self, map_args: M) -> VarEventNodeBuilder<I, F, M>
pub fn map_args<M, MA>(self, map_args: M) -> VarEventNodeBuilder<I, F, M>
Convert args.
The map_args closure is called in context, just before the handler is called.
Note that if the args is a full EventArgs type it must share the same propagation handle in the preview and normal route
properties, if the source type is also a full args just clone the propagation handle, otherwise you must use WIDGET::set_state
to communicate between the properties.
Source§impl<T, I, F, FB, MA, M> VarEventNodeBuilder<I, FB, M>
Build with filter and args mapping.
impl<T, I, F, FB, MA, M> VarEventNodeBuilder<I, 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<T, I, F, FB> VarEventNodeBuilder<I, FB, ()>
Build with filter and without args mapping.
impl<T, I, F, FB> VarEventNodeBuilder<I, FB, ()>
Build with filter and without args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&T) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&T) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Source§impl<T, I> VarEventNodeBuilder<I, (), ()>
Build without filter and without args mapping.
impl<T, I> VarEventNodeBuilder<I, (), ()>
Build without filter and without args mapping.
Sourcepub fn build<const PRE: bool>(
self,
child: impl IntoUiNode,
handler: Box<dyn FnMut(&T) -> HandlerResult + Send>,
) -> UiNode
pub fn build<const PRE: bool>( self, child: impl IntoUiNode, handler: Box<dyn FnMut(&T) -> HandlerResult + Send>, ) -> UiNode
Build node.
If PRE is true the handler is called before the children, preview route.
Source§impl<T, I, MA, M> VarEventNodeBuilder<I, (), M>
Build with no filter and args mapping.
impl<T, I, MA, M> VarEventNodeBuilder<I, (), 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<I, F, M> Freeze for VarEventNodeBuilder<I, F, M>
impl<I, F, M> RefUnwindSafe for VarEventNodeBuilder<I, F, M>
impl<I, F, M> Send for VarEventNodeBuilder<I, F, M>
impl<I, F, M> Sync for VarEventNodeBuilder<I, F, M>
impl<I, F, M> Unpin for VarEventNodeBuilder<I, F, M>
impl<I, F, M> UnwindSafe for VarEventNodeBuilder<I, F, M>
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