pub struct Callback<EVENT, MSG>(/* private fields */);
Expand description
A generic sized representation of a function that can be attached to a Node. The callback will essentially be owned by the element
Implementations§
Source§impl<EVENT, MSG> Callback<EVENT, MSG>where
EVENT: 'static,
MSG: 'static,
impl<EVENT, MSG> Callback<EVENT, MSG>where
EVENT: 'static,
MSG: 'static,
Sourcepub fn emit<T>(&self, value: T) -> MSGwhere
T: Into<EVENT>,
pub fn emit<T>(&self, value: T) -> MSGwhere
T: Into<EVENT>,
This method calls the actual callback.
Sourcepub fn reform<F, EVENT2>(self, func: F) -> Callback<EVENT2, MSG>where
F: Fn(EVENT2) -> EVENT + 'static,
pub fn reform<F, EVENT2>(self, func: F) -> Callback<EVENT2, MSG>where
F: Fn(EVENT2) -> EVENT + 'static,
Changes input type of the callback to another.
Works like common map
method but in an opposite direction.
Sourcepub fn map<F, MSG2>(self, func: F) -> Callback<EVENT, MSG2>where
F: Fn(MSG) -> MSG2 + 'static,
pub fn map<F, MSG2>(self, func: F) -> Callback<EVENT, MSG2>where
F: Fn(MSG) -> MSG2 + 'static,
Map the output of this callback to return a different type
pub fn map_callback<MSG2>(
self,
cb: Callback<MSG, MSG2>,
) -> Callback<EVENT, MSG2>where
MSG2: 'static,
Trait Implementations§
Auto Trait Implementations§
impl<EVENT, MSG> Freeze for Callback<EVENT, MSG>
impl<EVENT, MSG> !RefUnwindSafe for Callback<EVENT, MSG>
impl<EVENT, MSG> !Send for Callback<EVENT, MSG>
impl<EVENT, MSG> !Sync for Callback<EVENT, MSG>
impl<EVENT, MSG> Unpin for Callback<EVENT, MSG>
impl<EVENT, MSG> !UnwindSafe for Callback<EVENT, MSG>
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