Struct InvalidationRecord

Source
pub struct InvalidationRecord { /* private fields */ }
Expand description

One bounded provenance record for an invalidation request.

Records are immutable snapshots. Sequence values start at one and saturate at u64::MAX; they can therefore cease being unique only after saturation. was_coalesced says an element already had pending work, not that the new request had the same strength.

§Examples

use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, InvalidationSource, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate_from(ElementId(7), Invalidation::Layout, InvalidationSource::Event);
let snapshot = handle.invalidation_diagnostics();
assert_eq!(snapshot.records.len(), 1);
assert_eq!(snapshot.records[0].element_id(), ElementId(7));

Implementations§

Source§

impl InvalidationRecord

Provides the operations defined for InvalidationRecord.

Source

pub const fn sequence(&self) -> u64

Returns the one-based saturating request sequence.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate(ElementId(1), Invalidation::Paint);
assert_eq!(handle.invalidation_diagnostics().records[0].sequence(), 1);
Source

pub const fn element_tree_id(&self) -> ElementTreeId

Returns the retained-tree namespace that received the request.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate(ElementId(1), Invalidation::Paint);
assert_eq!(handle.invalidation_diagnostics().records[0].element_tree_id(), handle.element_tree_id());
Source

pub const fn element_id(&self) -> ElementId

Returns the tree-local target element ID.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate(ElementId(9), Invalidation::Paint);
assert_eq!(handle.invalidation_diagnostics().records[0].element_id(), ElementId(9));
Source

pub const fn invalidation(&self) -> Invalidation

Returns the requested retained-work strength before coalescing.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate(ElementId(1), Invalidation::Build);
assert_eq!(handle.invalidation_diagnostics().records[0].invalidation(), Invalidation::Build);
Source

pub const fn source(&self) -> InvalidationSource

Returns the diagnostic origin supplied by the caller.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, InvalidationSource, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate_from(ElementId(1), Invalidation::Paint, InvalidationSource::Model);
assert_eq!(handle.invalidation_diagnostics().records[0].source(), InvalidationSource::Model);
Source

pub const fn was_coalesced(&self) -> bool

Returns whether the target already had a pending invalidation.

The first request is false; subsequent requests before pending work is taken are true even when they strengthen the retained-work level.

§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::app::{Invalidation, RuntimeHandle};
let handle = RuntimeHandle::<()>::new();
handle.invalidate(ElementId(1), Invalidation::Paint);
handle.invalidate(ElementId(1), Invalidation::Build);
let records = handle.invalidation_diagnostics().records;
assert!(!records[0].was_coalesced());
assert!(records[1].was_coalesced());

Trait Implementations§

Source§

impl Clone for InvalidationRecord

Source§

fn clone(&self) -> InvalidationRecord

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 Debug for InvalidationRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for InvalidationRecord

Source§

fn eq(&self, other: &InvalidationRecord) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for InvalidationRecord

Source§

impl Eq for InvalidationRecord

Source§

impl StructuralPartialEq for InvalidationRecord

Auto Trait Implementations§

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<A> IntoClickAction<A> for A
where A: Clone + 'static,

Source§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Props for T
where T: Clone + 'static,