asr::watcher

Struct Pair

Source
pub struct Pair<T> {
    pub old: T,
    pub current: T,
}
Expand description

A pair consisting of an old and a current value that can be used for tracking changes between them.

Fields§

§old: T

The old value.

§current: T

The current value.

Implementations§

Source§

impl<T> Pair<T>

Source

pub fn check(&self, f: impl FnMut(&T) -> bool) -> bool

Checks if a condition is true for the current value but false for the old value.

Source

pub fn map<U>(self, f: impl FnMut(T) -> U) -> Pair<U>

Maps the pair to a new pair with a different type.

Source§

impl<T: Eq> Pair<T>

Source

pub fn changed(&self) -> bool

Checks if the value changed.

Source

pub fn unchanged(&self) -> bool

Checks if the value did not change.

Source

pub fn changed_to(&self, value: &T) -> bool

Checks if the value changed to a specific value that it was not before.

Source

pub fn changed_from(&self, value: &T) -> bool

Checks if the value changed from a specific value that it is not now.

Source

pub fn changed_from_to(&self, old: &T, current: &T) -> bool

Checks if the value changed from a specific value to another specific value.

Source§

impl<T: NoUninit> Pair<T>

Source

pub fn bytes_changed(&self) -> bool

Checks if the bytes of the value changed.

Source

pub fn bytes_unchanged(&self) -> bool

Checks if the bytes of the value did not change.

Source

pub fn bytes_changed_to(&self, value: &T) -> bool

Checks if the bytes of the value changed to a specific value that it was not before.

Source

pub fn bytes_changed_from(&self, value: &T) -> bool

Checks if the bytes of the value changed from a specific value that it is not now.

Source

pub fn bytes_changed_from_to(&self, old: &T, current: &T) -> bool

Checks if the bytes of the value changed from a specific value to another specific value.

Source§

impl<T: PartialOrd> Pair<T>

Source

pub fn increased(&self) -> bool

Checks if the value increased.

Source

pub fn decreased(&self) -> bool

Checks if the value decreased.

Trait Implementations§

Source§

impl<T: Clone> Clone for Pair<T>

Source§

fn clone(&self) -> Pair<T>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Default> Default for Pair<T>

Source§

fn default() -> Pair<T>

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

impl<T> Deref for Pair<T>

Source§

fn deref(&self) -> &Self::Target

Accesses the current value.

Source§

type Target = T

The resulting type after dereferencing.
Source§

impl<T: Clone + Widget> Widget for Pair<T>

Source§

type Args = <T as Widget>::Args

The arguments that are needed to register the widget.
Source§

fn register(key: &str, description: &str, args: Self::Args) -> Self

Registers the widget with the given key, description and default value. Returns the value that the user has set or the default value if the user did not set a value.
Source§

fn update_from(&mut self, settings_map: &Map, key: &str, args: Self::Args)

Updates the value of the setting based on the value that the user has set in the provided settings map.
Source§

impl<T: Copy> Copy for Pair<T>

Auto Trait Implementations§

§

impl<T> Freeze for Pair<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Pair<T>
where T: RefUnwindSafe,

§

impl<T> Send for Pair<T>
where T: Send,

§

impl<T> Sync for Pair<T>
where T: Sync,

§

impl<T> Unpin for Pair<T>
where T: Unpin,

§

impl<T> UnwindSafe for Pair<T>
where T: 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.