pub struct Callback<IN, OUT = ()> { /* private fields */ }
Expand description
Universal callback wrapper.
An Rc
wrapper is used to make it cloneable.
Implementations§
Source§impl<IN: 'static, OUT: 'static> Callback<IN, OUT>
impl<IN: 'static, OUT: 'static> Callback<IN, OUT>
Sourcepub fn reform<F, T>(&self, func: F) -> Callback<T, OUT>where
F: Fn(T) -> IN + 'static,
pub fn reform<F, T>(&self, func: F) -> Callback<T, OUT>where
F: Fn(T) -> IN + 'static,
Creates a new Callback
from another callback and a function.
That when emitted will call that function and will emit the original callback
Sourcepub fn reform_ref<F, T>(&self, func: F) -> CallbackRef<T, OUT>
pub fn reform_ref<F, T>(&self, func: F) -> CallbackRef<T, OUT>
Creates a new CallbackRef
from another callback and a function.
That when emitted will call that function and will emit the original callback
Sourcepub fn reform_ref_mut<F, T>(&self, func: F) -> CallbackRefMut<T, OUT>
pub fn reform_ref_mut<F, T>(&self, func: F) -> CallbackRefMut<T, OUT>
Creates a new CallbackRefMut
from another callback and a function.
That when emitted will call that function and will emit the original callback
Sourcepub fn filter_reform<F, T>(&self, func: F) -> Callback<T, Option<OUT>>
pub fn filter_reform<F, T>(&self, func: F) -> Callback<T, Option<OUT>>
Creates a new Callback
from another callback and a function.
When emitted will call the function and, only if it returns Some(value)
, will emit
value
to the original callback.
Sourcepub fn filter_reform_ref<F, T>(&self, func: F) -> CallbackRef<T, Option<OUT>>
pub fn filter_reform_ref<F, T>(&self, func: F) -> CallbackRef<T, Option<OUT>>
Creates a new CallbackRef
from another callback and a function.
When emitted will call the function and, only if it returns Some(value)
, will emit
value
to the original callback.
Sourcepub fn filter_reform_ref_mut<F, T>(
&self,
func: F,
) -> CallbackRefMut<T, Option<OUT>>
pub fn filter_reform_ref_mut<F, T>( &self, func: F, ) -> CallbackRefMut<T, Option<OUT>>
Creates a new CallbackRefMut
from another callback and a function.
When emitted will call the function and, only if it returns Some(value)
, will emit
value
to the original callback.
Trait Implementations§
Source§impl<T> From<UseReducerDispatcher<T>> for Callback<<T as Reducible>::Action>where
T: Reducible,
impl<T> From<UseReducerDispatcher<T>> for Callback<<T as Reducible>::Action>where
T: Reducible,
Source§fn from(val: UseReducerDispatcher<T>) -> Self
fn from(val: UseReducerDispatcher<T>) -> Self
Source§impl<T> From<UseStateSetter<T>> for Callback<T>
impl<T> From<UseStateSetter<T>> for Callback<T>
Source§fn from(value: UseStateSetter<T>) -> Self
fn from(value: UseStateSetter<T>) -> Self
Source§impl<IN, OUT> ImplicitClone for Callback<IN, OUT>
impl<IN, OUT> ImplicitClone for Callback<IN, OUT>
§fn implicit_clone(&self) -> Self
fn implicit_clone(&self) -> Self
Source§impl<EVENT> IntoEventCallback<EVENT> for &Callback<EVENT>
impl<EVENT> IntoEventCallback<EVENT> for &Callback<EVENT>
Source§fn into_event_callback(self) -> Option<Callback<EVENT>>
fn into_event_callback(self) -> Option<Callback<EVENT>>
self
to Option<Callback<EVENT>>
Source§impl<EVENT> IntoEventCallback<EVENT> for Callback<EVENT>
impl<EVENT> IntoEventCallback<EVENT> for Callback<EVENT>
Source§fn into_event_callback(self) -> Option<Callback<EVENT>>
fn into_event_callback(self) -> Option<Callback<EVENT>>
self
to Option<Callback<EVENT>>
Source§impl<T> IntoPropValue<Callback<<T as Reducible>::Action>> for UseReducerDispatcher<T>where
T: Reducible,
impl<T> IntoPropValue<Callback<<T as Reducible>::Action>> for UseReducerDispatcher<T>where
T: Reducible,
Source§impl<I, O, F> IntoPropValue<Callback<I, O>> for Fwhere
F: 'static + Fn(I) -> O,
impl<I, O, F> IntoPropValue<Callback<I, O>> for Fwhere
F: 'static + Fn(I) -> O,
Source§fn into_prop_value(self) -> Callback<I, O>
fn into_prop_value(self) -> Callback<I, O>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<Callback<T>> for UseStateSetter<T>
impl<T> IntoPropValue<Callback<T>> for UseStateSetter<T>
Source§fn into_prop_value(self) -> Callback<T>
fn into_prop_value(self) -> Callback<T>
self
to a value of a Properties
struct.Auto Trait Implementations§
impl<IN, OUT> Freeze for Callback<IN, OUT>
impl<IN, OUT = ()> !RefUnwindSafe for Callback<IN, OUT>
impl<IN, OUT = ()> !Send for Callback<IN, OUT>
impl<IN, OUT = ()> !Sync for Callback<IN, OUT>
impl<IN, OUT> Unpin for Callback<IN, OUT>
impl<IN, OUT = ()> !UnwindSafe for Callback<IN, OUT>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.