pub struct VecHistoric<T> { /* private fields */ }Implementations§
Source§impl<T> VecHistoric<T>
impl<T> VecHistoric<T>
Sourcepub fn pop_back(&mut self) -> Option<T>
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
Sourcepub fn pop_front(&mut self) -> Option<T>
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
Sourcepub fn push_back(&mut self, value: T)
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.
Sourcepub fn push_front(&mut self, value: T)
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.
Sourcepub fn insert(&mut self, index: usize, value: T)
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.
Sourcepub fn insert_many(&mut self, index: usize, iter: impl IntoIterator<Item = T>)
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.
Sourcepub fn clear(&mut self)
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.
Sourcepub fn drain(&mut self, range: impl RangeBounds<usize>) -> Drain<'_, T>
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.
Sourcepub fn get_inner_data(&self) -> &GapBuffer<T>
pub fn get_inner_data(&self) -> &GapBuffer<T>
Returns inner gap_buffer.
Sourcepub fn get_inner_data_mut(&mut self) -> &mut GapBuffer<T>
pub fn get_inner_data_mut(&mut self) -> &mut GapBuffer<T>
Returns inner gap_buffer.
Source§impl<T> VecHistoric<T>
impl<T> VecHistoric<T>
Sourcepub fn undo(&mut self) -> Vec<T>
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
Sourcepub fn clear_history(&mut self) -> Vec<T>
pub fn clear_history(&mut self) -> Vec<T>
Clears the history and returns all elements of all erased actions
Sourcepub fn clear_selects(&mut self)
pub fn clear_selects(&mut self)
Clears selects
Sourcepub fn len_selects(&self) -> usize
pub fn len_selects(&self) -> usize
Returns the count of selected elements
Sourcepub fn len_history(&self) -> usize
pub fn len_history(&self) -> usize
Returns the count of actions
Sourcepub fn iter_selects(&self) -> Iter<'_, usize>
pub fn iter_selects(&self) -> Iter<'_, usize>
Returns the iterator of selections
Sourcepub fn iter_history(&self) -> Iter<'_, Action<T>>
pub fn iter_history(&self) -> Iter<'_, Action<T>>
Returns the iterator of history
Sourcepub fn get_selected(&self) -> Vec<&T>
pub fn get_selected(&self) -> Vec<&T>
Returns the values of selected elements
Sourcepub fn is_selected(&mut self, index: usize) -> bool
pub fn is_selected(&mut self, index: usize) -> bool
Returns true if an element is selected
Sourcepub fn deselect_all(&mut self)
pub fn deselect_all(&mut self)
Deselect all elements
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Selects all elements
Sourcepub fn pop_back_historic(&mut self) -> Option<&T>
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
Sourcepub fn pop_front_historic(&mut self) -> Option<&T>
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
Sourcepub fn push_back_historic(&mut self, value: T)
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.
Sourcepub fn push_front_historic(&mut self, value: T)
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.
Sourcepub fn insert_historic(&mut self, index: usize, value: T)
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.
Sourcepub fn insert_many_historic(
&mut self,
index: usize,
iter: impl IntoIterator<Item = T>,
)
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.
Sourcepub fn remove_selects(&mut self) -> Vec<T>
pub fn remove_selects(&mut self) -> Vec<T>
Removes selected elements and returns them
Sourcepub fn remove_selects_historic(&mut self) -> &Vec<T>
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
Sourcepub fn move_selects(&mut self, to_index: usize)
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
Sourcepub fn move_selects_historic(&mut self, to_index: usize)
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>
impl<T> VecHistoric<T>
pub fn from_data(data: GapBuffer<T>) -> Self
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Creates an empty collection with the specified capacity (if supported).
Sourcepub fn from_slice(slice: &[T]) -> Selfwhere
T: Clone,
pub fn from_slice(slice: &[T]) -> Selfwhere
T: Clone,
Creates a collection from a slice by cloning each element.
Sourcepub fn from_array<const N: usize>(arr: [T; N]) -> Self
pub fn from_array<const N: usize>(arr: [T; N]) -> Self
Creates a collection from an array.
Sourcepub fn repeat(value: T, n: usize) -> Selfwhere
T: Clone,
pub fn repeat(value: T, n: usize) -> Selfwhere
T: Clone,
Creates a collection with n clones of a given value.
Sourcepub fn to_owned_from(slice: &[T]) -> Selfwhere
T: Clone,
pub fn to_owned_from(slice: &[T]) -> Selfwhere
T: Clone,
Converts a slice into a collection (alias to from_slice).
Trait Implementations§
Source§impl<T: Clone> Clone for VecHistoric<T>
impl<T: Clone> Clone for VecHistoric<T>
Source§fn clone(&self) -> VecHistoric<T>
fn clone(&self) -> VecHistoric<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for VecHistoric<T>
impl<T: Debug> Debug for VecHistoric<T>
Source§impl<T> Extend<T> for VecHistoric<T>
impl<T> Extend<T> for VecHistoric<T>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<T> From<GapBuffer<T>> for VecHistoric<T>
impl<T> From<GapBuffer<T>> for VecHistoric<T>
Source§impl<T> FromIterator<T> for VecHistoric<T>
impl<T> FromIterator<T> for VecHistoric<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Source§impl<T: Hash> Hash for VecHistoric<T>
impl<T: Hash> Hash for VecHistoric<T>
Source§impl<T> Index<usize> for VecHistoric<T>
impl<T> Index<usize> for VecHistoric<T>
Source§impl<T> IndexMut<usize> for VecHistoric<T>
impl<T> IndexMut<usize> for VecHistoric<T>
Source§impl<'a, T> IntoIterator for &'a VecHistoric<T>
impl<'a, T> IntoIterator for &'a VecHistoric<T>
Source§impl<'a, T> IntoIterator for &'a mut VecHistoric<T>
impl<'a, T> IntoIterator for &'a mut VecHistoric<T>
Source§impl<T> IntoIterator for VecHistoric<T>
impl<T> IntoIterator for VecHistoric<T>
Source§impl<T: Ord> Ord for VecHistoric<T>
impl<T: Ord> Ord for VecHistoric<T>
Source§impl<T: PartialEq> PartialEq for VecHistoric<T>
impl<T: PartialEq> PartialEq for VecHistoric<T>
Source§impl<T: PartialOrd> PartialOrd for VecHistoric<T>
impl<T: PartialOrd> PartialOrd for VecHistoric<T>
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>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.