VecHistoric

Struct VecHistoric 

Source
pub struct VecHistoric<T> { /* private fields */ }

Implementations§

Source§

impl<T> VecHistoric<T>

Source

pub fn pop_back(&mut self) -> Option<T>

Removes the last element from a vector and returns it, or None if it is empty. History and selects are wiped for preventing index shifting

Source

pub fn pop_front(&mut self) -> Option<T>

Removes the last element from a vector and returns it, or None if it is empty. History and selects are wiped for preventing index shifting

Source

pub fn push_back(&mut self, value: T)

Appends an element to the back of a VecHistoric.

§Panics

Panics if the number of elements in the VecHistoric overflows a usize.

Source

pub fn push_front(&mut self, value: T)

Appends an element to the front of a VecHistoric. History and selects are wiped for preventing index shifting

§Panics

Panics if the number of elements in the VecHistoric overflows a usize.

Source

pub fn insert(&mut self, index: usize, value: T)

Inserts an element at position index within the vector History and selects are wiped for preventing index shifting

§Panics

Panics if index > len.

Source

pub fn insert_many(&mut self, index: usize, iter: impl IntoIterator<Item = T>)

Inserts elements or iterator at position index within the vector History and selects are wiped for preventing index shifting

§Panics

Panics if index > len.

Source

pub fn remove(&mut self, index: usize) -> T

Removes an element from the VecHistoric and returns it. History and selects are wiped for preventing index shifting

§Panics

Panics if index >= self.len().

§Computational amount

O(n), n = |index - self.gap()|

Source

pub fn len(&self) -> usize

Returns the number of elements in the VecHistoric.

Source

pub fn is_empty(&self) -> bool

Returns true if the VecHistoric contains no elements.

Source

pub fn clear(&mut self)

Clears the GapBuffer, removing all values. History and selects are wiped for preventing index shifting

Note that this method has no effect on the allocated capacity of the GapBuffer.

Source

pub fn drain(&mut self, range: impl RangeBounds<usize>) -> Drain<'_, T>

Creates a draining iterator that removes the specified range in the GapBuffer and yields the removed items. History and selects are wiped for preventing index shifting

  • Note 1: The element range is removed even if the iterator is only partially consumed or not consumed at all.
  • Note 2: It is unspecified how many elements are removed from the GapBuffer if the Drain value is leaked.
§Panics

Panics if the range is out of bounds.

Source

pub fn get_inner_data(&self) -> &GapBuffer<T>

Returns inner gap_buffer.

Source

pub fn get_inner_data_mut(&mut self) -> &mut GapBuffer<T>

Returns inner gap_buffer.

Source§

impl<T> VecHistoric<T>

Source

pub fn undo(&mut self) -> Vec<T>

Undo last action in the collection and returns erased elements of it If history len is 0 OR an action contains no elements returns empty vec

Source

pub fn clear_history(&mut self) -> Vec<T>

Clears the history and returns all elements of all erased actions

Source

pub fn clear_selects(&mut self)

Clears selects

Source

pub fn len_selects(&self) -> usize

Returns the count of selected elements

Source

pub fn len_history(&self) -> usize

Returns the count of actions

Source

pub fn iter_selects(&self) -> Iter<'_, usize>

Returns the iterator of selections

Source

pub fn iter_history(&self) -> Iter<'_, Action<T>>

Returns the iterator of history

Source

pub fn get_selected(&self) -> Vec<&T>

Returns the values of selected elements

Source

pub fn select(&mut self, index: usize)

Selects an element by index

Source

pub fn deselect(&mut self, index: usize) -> bool

Deselects an element by index

Source

pub fn is_selected(&mut self, index: usize) -> bool

Returns true if an element is selected

Source

pub fn deselect_all(&mut self)

Deselect all elements

Source

pub fn select_all(&mut self)

Selects all elements

Source

pub fn pop_back_historic(&mut self) -> Option<&T>

Removes the last element from a VecHistoric and returns its address, or None if it is empty. Creates an action in history sequence

Source

pub fn pop_front_historic(&mut self) -> Option<&T>

Removes the first element from a VecHistoric and returns its address, or None if it is empty. Creates an action in history sequence

Source

pub fn push_back_historic(&mut self, value: T)

Appends an element to the back of a VecHistoric. Creates an action in history sequence

§Panics

Panics if the number of elements in the VecHistoric overflows a usize.

Source

pub fn push_front_historic(&mut self, value: T)

Appends an element to the front of a VecHistoric. Creates an action in history sequence

§Panics

Panics if the number of elements in the VecHistoric overflows a usize.

Source

pub fn insert_historic(&mut self, index: usize, value: T)

Inserts an element at position index within the VecHistoric Selects the inserted element Creates an action in history sequence

§Panics

Panics if index > len.

Source

pub fn insert_many_historic( &mut self, index: usize, iter: impl IntoIterator<Item = T>, )

Inserts an elements or iterator at position index within the VecHistoric Selects the inserted elements Creates an action in history sequence

§Panics

Panics if index > len.

Source

pub fn remove_selects(&mut self) -> Vec<T>

Removes selected elements and returns them

Source

pub fn remove_selects_historic(&mut self) -> &Vec<T>

Removes selected elements and returns address of the removed elements Creates an action in history sequence

Source

pub fn move_selects(&mut self, to_index: usize)

Moves selected elements to a specific position index History and selects are wiped for preventing index shifting

Source

pub fn move_selects_historic(&mut self, to_index: usize)

Moves selected elements to a specific position index Creates an action in history sequence

Source§

impl<T> VecHistoric<T>

Source

pub fn from_data(data: GapBuffer<T>) -> Self

Source

pub fn new() -> Self

Creates an empty collection.

Source

pub fn with_capacity(cap: usize) -> Self

Creates an empty collection with the specified capacity (if supported).

Source

pub fn from_slice(slice: &[T]) -> Self
where T: Clone,

Creates a collection from a slice by cloning each element.

Source

pub fn from_array<const N: usize>(arr: [T; N]) -> Self

Creates a collection from an array.

Source

pub fn repeat(value: T, n: usize) -> Self
where T: Clone,

Creates a collection with n clones of a given value.

Source

pub fn to_owned_from(slice: &[T]) -> Self
where T: Clone,

Converts a slice into a collection (alias to from_slice).

Trait Implementations§

Source§

impl<T: Clone> Clone for VecHistoric<T>

Source§

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

Returns a duplicate 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: Debug> Debug for VecHistoric<T>

Source§

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

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

impl<T> Extend<T> for VecHistoric<T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> From<GapBuffer<T>> for VecHistoric<T>

Source§

fn from(other: GapBuffer<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<T> for VecHistoric<T>

Source§

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

Creates a value from an iterator. Read more
Source§

impl<T: Hash> Hash for VecHistoric<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> Index<usize> for VecHistoric<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, idx: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<usize> for VecHistoric<T>

Source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T> IntoIterator for &'a VecHistoric<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Chain<Iter<'a, T>, Iter<'a, T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a mut VecHistoric<T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = Chain<IterMut<'a, T>, IterMut<'a, T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for VecHistoric<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Ord> Ord for VecHistoric<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for VecHistoric<T>

Source§

fn eq(&self, other: &Self) -> 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<T: PartialOrd> PartialOrd for VecHistoric<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: Eq> Eq for VecHistoric<T>

Auto Trait Implementations§

§

impl<T> Freeze for VecHistoric<T>

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for VecHistoric<T>

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

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

Checks if this value is equivalent to the given key. Read more
Source§

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

Source§

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