[−]Struct sauron::prelude::mt_dom::Callback
A generic sized representation of a function that can be attached to a Node. The callback will essentially be owned by the element
Limitations: The callback takes an Fn instead of FnMut, therefore it can not mutate the environment variables
In effect callbacks attached to DOM events are limited to only passing an MSG to the program and not complex statements.
Implementations
impl<EVENT, MSG> Callback<EVENT, MSG> where
EVENT: 'static,
MSG: 'static,
EVENT: 'static,
MSG: 'static,
pub fn emit<T>(&self, value: T) -> MSG where
T: Into<EVENT>,
T: Into<EVENT>,
This method calls the actual callback.
pub fn map_callback<MSG2>(
self,
cb: Callback<MSG, MSG2>
) -> Callback<EVENT, MSG2> where
MSG2: 'static,
self,
cb: Callback<MSG, MSG2>
) -> Callback<EVENT, MSG2> where
MSG2: 'static,
map this callback using another callback such that MSG becomes MSG2
Trait Implementations
impl<EVENT, MSG> Clone for Callback<EVENT, MSG>
Note: using the #[derive(Clone)] needs EVENT and MSG to also be Clone
The reason this is manually implemented is, so that EVENT and MSG doesn't need to be Clone as it is part of the Callback objects and cloning here is just cloning the pointer of the actual callback function
pub fn clone(&self) -> Callback<EVENT, MSG>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<EVENT, MSG> Debug for Callback<EVENT, MSG>
Note: using the #[derive(Debug)] needs EVENT and MSG to also be Debug
The reason this is manually implemented is, so that EVENT and MSG doesn't need to be Debug as it is part of the Callback objects and are not shown.
impl<EVENT, F, MSG> From<F> for Callback<EVENT, MSG> where
F: Fn(EVENT) -> MSG + 'static,
F: Fn(EVENT) -> MSG + 'static,
impl<EVENT, MSG> PartialEq<Callback<EVENT, MSG>> for Callback<EVENT, MSG>
Note: using the #[derive(PartialEq)] needs EVENT and MSG to also be PartialEq.
The reason this is manually implemented is, so that EVENT and MSG doesn't need to be PartialEq as it is part of the Callback objects and are not compared
Auto Trait Implementations
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,