pub struct UniqueContainer<T> { /* private fields */ }Expand description
- Each value is unique in this container. if multiple indices have to refer to the same value, then only one index points to the real value and the others point to indirect values, which are just jump indices to the real value.
- You can get a value via its index.
Implementations§
Source§impl<T> UniqueContainer<T>
impl<T> UniqueContainer<T>
Source§impl<T> UniqueContainer<T>
impl<T> UniqueContainer<T>
Sourcepub fn truncate(&mut self, len: usize)
pub fn truncate(&mut self, len: usize)
Shortens the container to the given length.
All indices beyond the length will be invalidated.
Sourcepub fn insert(&mut self, value: T) -> usize
pub fn insert(&mut self, value: T) -> usize
Inserts the given value in the container.
If the same value was found by PartialEq, then the old value is replaced with the given
new value.
pub fn next_index<Q>(&mut self, value: &Q) -> usize
pub fn replace<Q>(&mut self, old: &Q, new: T) -> bool
pub fn find<Q>(&self, value: &Q) -> Option<usize>
Trait Implementations§
Source§impl<T: Clone> Clone for UniqueContainer<T>
impl<T: Clone> Clone for UniqueContainer<T>
Source§fn clone(&self) -> UniqueContainer<T>
fn clone(&self) -> UniqueContainer<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for UniqueContainer<T>
impl<T: Debug> Debug for UniqueContainer<T>
Source§impl<T> Default for UniqueContainer<T>
impl<T> Default for UniqueContainer<T>
Auto Trait Implementations§
impl<T> Freeze for UniqueContainer<T>
impl<T> !RefUnwindSafe for UniqueContainer<T>
impl<T> Send for UniqueContainer<T>where
T: Send,
impl<T> !Sync for UniqueContainer<T>
impl<T> Unpin for UniqueContainer<T>where
T: Unpin,
impl<T> UnwindSafe for UniqueContainer<T>where
T: 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
Mutably borrows from an owned value. Read more