Skip to main content

MotionSharedValues

Struct MotionSharedValues 

Source
pub struct MotionSharedValues(/* private fields */);
Expand description

A shareable registry for integer MotionLayout shared values. Layout states attached to the same registry receive changes in order.

Implementations§

Source§

impl MotionSharedValues

Source

pub fn global() -> Self

Return the process-wide registry, shared by every caller.

Source

pub fn set(&self, key: &'static str, value: i32) -> bool

Publish a changed value. Returns false for a duplicate or an unset -1.

Source

pub fn get(&self, key: &str) -> Option<i32>

Source

pub fn get_value(&self, key: &str) -> i32

Return the current value, or AndroidX’s UNSET value (-1).

Source

pub fn add_listener( &self, key: &'static str, callback: impl Fn(&'static str, i32, i32) + Send + Sync + 'static, ) -> MotionSharedValuesListener

Listen for changed values on a key. Callbacks run synchronously after the registry lock is released and receive (key, new value, previous value).

Source

pub fn add_listener_for_key( &self, key: &'static str, listener: &MotionSharedValuesListener, )

Register an existing listener for another key.

Source

pub fn remove_listener(&self, key: &str, listener: &MotionSharedValuesListener)

Remove all registrations of this listener for one key.

Source

pub fn remove_listener_from_all(&self, listener: &MotionSharedValuesListener)

Remove this listener from every key.

Source

pub fn clear_listeners(&self)

Remove all host and layout listeners without clearing stored values. Layout events queued before this call remain available for delivery.

Trait Implementations§

Source§

impl Clone for MotionSharedValues

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MotionSharedValues

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for MotionSharedValues

§

impl Freeze for MotionSharedValues
where *const ArcInner<Mutex<MotionSharedValuesInner>> is !null: Freeze, PhantomData<ArcInner<Mutex<MotionSharedValuesInner>>>: Freeze,

§

impl Move for MotionSharedValues

§

impl RefUnwindSafe for MotionSharedValues
where Atomic<usize>: RefUnwindSafe, Mutex<MotionSharedValuesInner>: RefUnwindSafe,

§

impl Send for MotionSharedValues
where Arc<Mutex<MotionSharedValuesInner>>: Send,

§

impl Sync for MotionSharedValues
where Arc<Mutex<MotionSharedValuesInner>>: Sync,

§

impl Unpin for MotionSharedValues
where Arc<Mutex<MotionSharedValuesInner>>: Unpin,

§

impl UnsafeUnpin for MotionSharedValues
where *const ArcInner<Mutex<MotionSharedValuesInner>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<MotionSharedValuesInner>>>: UnsafeUnpin,

§

impl UnwindSafe for MotionSharedValues
where Arc<Mutex<MotionSharedValuesInner>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.