pub struct AnimationStatusListener { /* private fields */ }Expand description
Signature for listeners attached using Animation::add_status_listener.
Like Listener, this is a handle matched by identity: a listener over a
closure (AnimationStatusListener::new) is equal only to its own clones,
and a listener over an entity’s associated function
(AnimationStatusListener::handle_method) is equal to any other built
from the same entity and function.
Implementations§
Source§impl AnimationStatusListener
impl AnimationStatusListener
Sourcepub fn new(
callback: impl Fn(AnimationStatus, &mut App) + 'static,
) -> AnimationStatusListener
pub fn new( callback: impl Fn(AnimationStatus, &mut App) + 'static, ) -> AnimationStatusListener
Wraps a closure as a status listener.
Sourcepub fn handle_method<T, F>(this: Handle<T>, f: F) -> AnimationStatusListener
pub fn handle_method<T, F>(this: Handle<T>, f: F) -> AnimationStatusListener
Wraps an entity’s associated function as a status listener.
The counterpart of Dart passing the notifyStatusListeners tear-off;
see Listener::handle_method for the identity rule. Pass the
function by name — the compile-time assert rejects fn pointers and
capturing closures, which have no canonical identity.
The function is receiver-first, (Handle<T>, &mut App, AnimationStatus),
so a method on Handle<T> can be named directly.
Like Listener::handle_method, it does not keep its receiver, and is skipped once the
receiver is freed.
Sourcepub fn call(&self, status: AnimationStatus, app: &mut App)
pub fn call(&self, status: AnimationStatus, app: &mut App)
Calls the closure.
Sourcepub fn downgrade(&self) -> WeakAnimationStatusListener
pub fn downgrade(&self) -> WeakAnimationStatusListener
A reference to this listener that does not keep its closure alive, for a closure that
removes itself: Dart’s late AnimationStatusListener l; l = (status) { ...; animation.removeStatusListener(l); }; names itself, and a closure holding its own
listener strongly would keep itself alive after the animation lets it go.
Trait Implementations§
Source§impl Clone for AnimationStatusListener
impl Clone for AnimationStatusListener
Source§fn clone(&self) -> AnimationStatusListener
fn clone(&self) -> AnimationStatusListener
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnimationStatusListener
impl Debug for AnimationStatusListener
impl Eq for AnimationStatusListener
Source§impl Hash for AnimationStatusListener
impl Hash for AnimationStatusListener
Auto Trait Implementations§
impl !RefUnwindSafe for AnimationStatusListener
impl !Send for AnimationStatusListener
impl !Sync for AnimationStatusListener
impl !UnwindSafe for AnimationStatusListener
impl Forget for AnimationStatusListener
impl Freeze for AnimationStatusListener
impl Move for AnimationStatusListener
impl Unpin for AnimationStatusListener
impl UnsafeUnpin for AnimationStatusListenerwhere
*const RcInner<dyn Fn(AnimationStatus, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(AnimationStatus, &mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
Blanket Implementations§
Source§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.