Skip to main content

Change

Struct Change 

Source
pub struct Change<T> { /* private fields */ }
Expand description

A change of a list (Change<T>): of one item, or of a range of items.

Upstream’s change of one item has an empty range (RangeChange<T>.Empty), and a change of a range has an empty item (ItemChange<T>.Empty, whose item is the default value of T); here range is empty for the change of an item, and the change of a range has no item (try_item).

Implementations§

Source§

impl<T> Change<T>

Source

pub fn new(reason: ListChangeReason, current: T, index: Option<usize>) -> Self

The change of one item (Change(ListChangeReason, T, int index = -1)).

Source

pub fn range_change( reason: ListChangeReason, items: Vec<T>, index: Option<usize>, ) -> Self

The change of a range (Change(ListChangeReason, IEnumerable<T>, int index = -1)).

§Panics

For a reason of one item (IndexOutOfRangeException).

Source

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

A move (Change(T, int currentIndex, int previousIndex)).

Source

pub fn with_previous( reason: ListChangeReason, current: T, previous: Option<T>, current_index: Option<usize>, previous_index: Option<usize>, ) -> Self

The change of one item with every part (Change(ListChangeReason, T, in Optional<T>, int, int)).

§Panics

For Add with a previous item, Replace without one, and Refresh without an index (ArgumentException).

Source

pub fn reason(&self) -> ListChangeReason

The reason (Reason).

Source

pub fn change_type(&self) -> ChangeType

Whether the change is of an item or of a range (Type).

Source

pub fn item(&self) -> &ItemChange<T>

The change of the item (Item).

§Panics

For the change of a range, whose item upstream is empty.

Source

pub fn try_item(&self) -> Option<&ItemChange<T>>

The change of the item, None for the change of a range.

Source

pub fn range(&self) -> &RangeChange<T>

The range (Range): empty for the change of an item.

Trait Implementations§

Source§

impl<T: Clone> Clone for Change<T>

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<T> Debug for Change<T>
where T: Debug,

Source§

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

ToString, with the item or the range.

Source§

impl<T: Eq> Eq for Change<T>

Source§

impl<T> FromIterator<Change<T>> for ChangeSet<T>

Source§

fn from_iter<I: IntoIterator<Item = Change<T>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Hash> Hash for Change<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for Change<T>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for Change<T>

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
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.