[−][src]Struct yew_state::handle::StateHandle
Interface to shared state
Implementations
impl<T, H> StateHandle<T, H> where
T: Default + Clone + 'static,
H: Handler<Model = T>,
[src]
T: Default + Clone + 'static,
H: Handler<Model = T>,
pub fn state(&self) -> &T
[src]
pub fn reduce(&self, f: impl FnOnce(&mut T) + 'static)
[src]
Apply a function that may mutate shared state.
Changes are not immediate, and must be handled in Component::change
.
pub fn reduce_callback<E: 'static>(
&self,
f: impl Fn(&mut T) + 'static
) -> Callback<E> where
T: 'static,
[src]
&self,
f: impl Fn(&mut T) + 'static
) -> Callback<E> where
T: 'static,
Convenience method for modifying shared state directly from a Callback
.
The callback event is ignored here, see reduce_callback_with
for the alternative.
pub fn reduce_callback_once<E: 'static>(
&self,
f: impl FnOnce(&mut T) + 'static
) -> Callback<E> where
T: 'static,
[src]
&self,
f: impl FnOnce(&mut T) + 'static
) -> Callback<E> where
T: 'static,
Convenience method for modifying shared state directly from a CallbackOnce
.
The callback event is ignored here, see reduce_callback_once_with
for the alternative.
pub fn reduce_callback_with<E: 'static>(
&self,
f: impl Fn(&mut T, E) + 'static
) -> Callback<E> where
T: 'static,
E: Clone,
[src]
&self,
f: impl Fn(&mut T, E) + 'static
) -> Callback<E> where
T: 'static,
E: Clone,
Convenience method for modifying shared state directly from a Callback
.
Similar to reduce_callback
but it also accepts the fired event.
pub fn reduce_callback_once_with<E: 'static>(
&self,
f: impl FnOnce(&mut T, E) + 'static
) -> Callback<E> where
T: 'static,
[src]
&self,
f: impl FnOnce(&mut T, E) + 'static
) -> Callback<E> where
T: 'static,
Convenience method for modifying shared state directly from a CallbackOnce
.
Similar to reduce_callback
but it also accepts the fired event.
Trait Implementations
impl<T, H> Clone for StateHandle<T, H> where
T: Default + Clone + 'static,
H: Handler,
[src]
T: Default + Clone + 'static,
H: Handler,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Default, H: Default> Default for StateHandle<T, H> where
T: Default + Clone + 'static,
H: Handler,
[src]
T: Default + Clone + 'static,
H: Handler,
fn default() -> StateHandle<T, H>
[src]
impl<T, H> Handle for StateHandle<T, H> where
T: Default + Clone,
H: Handler<Model = T>,
[src]
T: Default + Clone,
H: Handler<Model = T>,
type Handler = H
fn set_local_state(&mut self, state: Rc<<Self::Handler as Handler>::Model>)
[src]
fn set_local_callback(
&mut self,
callback: Callback<Rc<dyn Fn(&mut <Self::Handler as Handler>::Model)>>,
callback_once: Callback<Box<dyn FnOnce(&mut <Self::Handler as Handler>::Model)>>
)
[src]
&mut self,
callback: Callback<Rc<dyn Fn(&mut <Self::Handler as Handler>::Model)>>,
callback_once: Callback<Box<dyn FnOnce(&mut <Self::Handler as Handler>::Model)>>
)
fn set_local(&mut self, other: &Self)
[src]
impl<T, H> PartialEq<StateHandle<T, H>> for StateHandle<T, H> where
T: Default + PartialEq + Clone + 'static,
H: Handler,
[src]
T: Default + PartialEq + Clone + 'static,
H: Handler,
impl<T, H> Properties for StateHandle<T, H> where
T: Default + Clone + 'static,
H: Handler,
[src]
T: Default + Clone + 'static,
H: Handler,
type Builder = StateHandleBuilder<T, H, StateHandleBuilderStep_build>
Builder that will be used to construct properties
fn builder() -> Self::Builder
[src]
impl<T, H> SharedState for StateHandle<T, H> where
T: Default + Clone + 'static,
H: Handler<Model = T>,
[src]
T: Default + Clone + 'static,
H: Handler<Model = T>,
Auto Trait Implementations
impl<T, H> !RefUnwindSafe for StateHandle<T, H>
impl<T, H> !Send for StateHandle<T, H>
impl<T, H> !Sync for StateHandle<T, H>
impl<T, H> Unpin for StateHandle<T, H> where
H: Unpin,
H: Unpin,
impl<T, H> !UnwindSafe for StateHandle<T, H>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
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.
fn to_owned(&self) -> T
[src]
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.
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>,