pub struct Callback<IN> { /* private fields */ }
Expand description
Callback is a wrapper around a function that is used to send messages to the Component.
IN
is the type of the input of the wrapped function.
Meaning if we would like to send a message to the component we need to provide input of type IN
.
Callback should be used for defining child to parent component communication and subscribing
to HTML events.
Implementations§
Source§impl<IN> Callback<IN>
impl<IN> Callback<IN>
Sourcepub fn new<F>(wrapper: F) -> Selfwhere
F: Fn(IN) + 'static,
pub fn new<F>(wrapper: F) -> Selfwhere
F: Fn(IN) + 'static,
Function that creates a new instance of the Callback.
Using a Callback defined by this function will not send messages to the component.
It should be used only if the Callback is to send messages
to the father component and this logic should be contained in wrapper
argument function.
If sending the message to the current component
is the goal create_callback function should be used.
Trait Implementations§
Auto Trait Implementations§
impl<IN> Freeze for Callback<IN>
impl<IN> !RefUnwindSafe for Callback<IN>
impl<IN> !Send for Callback<IN>
impl<IN> !Sync for Callback<IN>
impl<IN> Unpin for Callback<IN>
impl<IN> !UnwindSafe for Callback<IN>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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