FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Change

    struct · ferroui-dynamic-data · v0.5.0

    struct Change<T, K>
    

    A change of one item of a cache (Change<TObject, TKey>): its reason, its key, the item and, for an update, the item it replaced; the indexes for a sorted collection.

    Deviation (DEVIATIONS.md, DynamicData): the indexes are Option<usize>, where upstream writes -1 for no index.

    View source

    Members

    new

    fn new(reason: ChangeReason, key: K, current: T) -> Self
    

    A change without a previous item (Change(ChangeReason, TKey, TObject, int index = -1)).

    Panics

    For ChangeReason::Update, which needs the previous item (ArgumentException).

    Source

    with_index

    fn with_index(reason: ChangeReason, key: K, current: T, index: Option<usize>) -> Self
    

    A change with the index of the item (Change(ChangeReason, TKey, TObject, int index)).

    Source

    with_previous

    fn with_previous(reason: ChangeReason, key: K, current: T, previous: Option<T>, current_index: Option<usize>, previous_index: Option<usize>) -> Self
    

    A change with every part (Change(ChangeReason, TKey, TObject, in Optional<TObject>, int, int)).

    Panics

    For ChangeReason::Add with a previous item, and for ChangeReason::Update without one (ArgumentException).

    Source

    update

    fn update(key: K, current: T, previous: T) -> Self
    

    An update of key from previous to current (Change(ChangeReason.Update, key, current, previous)).

    Source

    moved

    fn moved(key: K, current: T, current_index: usize, previous_index: usize) -> Self
    

    A move within a sorted collection (Change(TKey, TObject, int currentIndex, int previousIndex)).

    Source

    key

    fn key(self: &Self) -> &K
    

    The key of the item (Key).

    Source

    reason

    fn reason(self: &Self) -> ChangeReason
    

    The reason of the change (Reason).

    Source

    current

    fn current(self: &Self) -> &T
    

    The item (Current).

    Source

    previous

    fn previous(self: &Self) -> Option<&T>
    

    The item that an update replaced (Previous).

    Source

    current_index

    fn current_index(self: &Self) -> Option<usize>
    

    The index of the item in a sorted collection (CurrentIndex; -1 upstream when none).

    Source

    previous_index

    fn previous_index(self: &Self) -> Option<usize>
    

    The previous index of the item (PreviousIndex).

    Source

    into_parts

    fn into_parts(self: Self) -> (ChangeReason, K, T, Option<T>)
    

    The parts of the change, taken apart.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • Equivalent<K>
    • Clone
    • StructuralPartialEq
    • PartialEq
    • Eq
    • Hash
    • Debug
    • FromIterator<Change<T, K>>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.