pub struct Effect { /* private fields */ }
Expand description
Effects allow you to run code when a signal changes. Effects are run immediately and whenever any signal it reads changes.
Implementations§
§impl Effect
impl Effect
pub fn new(callback: impl FnMut() + 'static) -> Effect
pub fn new(callback: impl FnMut() + 'static) -> Effect
Create a new effect. The effect will be run immediately and whenever any signal it reads changes.
The signal will be owned by the current component and will be dropped when the component is dropped.
pub fn try_run(&mut self)
pub fn try_run(&mut self)
Run the effect callback immediately. Returns true
if the effect was run. Returns false
is the effect is dead.
pub fn id(&self) -> GenerationalBoxId
pub fn id(&self) -> GenerationalBoxId
Get the id of this effect.
Trait Implementations§
impl Copy for Effect
impl StructuralPartialEq for Effect
Auto Trait Implementations§
impl !RefUnwindSafe for Effect
impl !Send for Effect
impl !Sync for Effect
impl Unpin for Effect
impl !UnwindSafe for Effect
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
§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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.