[−][src]Struct isize_vec::IsizeVec
Container for multiple elements sorted by a certain isize
order.
Every element T
is tagged with an associated isize
. The isize
value decides the relative
ordering of the elements. All manipulations keep the items T
ordered according to the isize
values from lowest to highest.
use isize_vec::IsizeVec; let mut vector = IsizeVec::new(); vector.insert(10, 'a'); vector.insert(5, 'b'); println!("{:?}", vector); for value in vector { println!("{}", value); }
Methods
impl<T> IsizeVec<T>
[src]
pub fn new() -> Self
[src]
Create a new vector.
pub fn iter(&self) -> Iter<T>
[src]
Get an iterator to the values.
pub fn iter_mut(&mut self) -> IterMut<T>
[src]
Get an iterator to the values (mutable).
pub fn push(&mut self, item: T) -> usize
[src]
Push a value to the end of the vector, with relative: isize::MAX
.
pub fn pop(&mut self) -> Option<(T, isize)>
[src]
Remove the last element from this vector.
pub fn drain<R>(&mut self, range: R) -> Drain<T> where
R: Clone + RangeBounds<usize>,
[src]
R: Clone + RangeBounds<usize>,
Create a drain iterator.
pub fn len(&self) -> usize
[src]
Returns the length of the container
pub fn is_empty(&self) -> bool
[src]
Returns whether the container is empty.
pub fn get(&self, index: usize) -> Option<&T>
[src]
Get the item at a given index.
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
[src]
Get the item at a given index.
pub fn extract(&mut self) -> Vec<T>
[src]
Return the backing vector and clear this container.
pub fn first_positive(&self) -> usize
[src]
Find the index at which positive elements start.
pub fn insert(&mut self, relative: isize, item: T) -> usize
[src]
Insert a value into this vector.
The value relative
indicates where the value will be put in the list relative to other
values. If two values have the same relative
value, then the value will be prepended if it
is signed, and appended if unsigned.
Returns the index of insertion.
pub fn remove(&mut self, index: usize) -> (T, isize)
[src]
Remove the given index from the vector.
pub fn first_right_of(&self, relative: isize) -> usize
[src]
Find the first index to the right of the relative list.
pub fn swap(&mut self, a: usize, b: usize)
[src]
Swap two elements in the list. Associated order is swapped.
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
[src]
F: FnMut(&T) -> bool,
Same as Vec::retain.
Trait Implementations
impl<T: Clone> Clone for IsizeVec<T>
[src]
impl<T: Debug> Debug for IsizeVec<T>
[src]
impl<T> Default for IsizeVec<T>
[src]
impl<T, I> Index<I> for IsizeVec<T> where
I: SliceIndex<[T]>,
[src]
I: SliceIndex<[T]>,
type Output = <I as SliceIndex<[T]>>::Output
The returned type after indexing.
fn index(&self, index: I) -> &<Vec<T> as Index<I>>::Output
[src]
impl<T, I> IndexMut<I> for IsizeVec<T> where
I: SliceIndex<[T]>,
[src]
I: SliceIndex<[T]>,
impl<T> IntoIterator for IsizeVec<T>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> IntoIter<T>
[src]
impl<'a, T> IntoIterator for &'a IsizeVec<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a, T>
[src]
impl<'a, T> IntoIterator for &'a mut IsizeVec<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for IsizeVec<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for IsizeVec<T> where
T: Send,
T: Send,
impl<T> Sync for IsizeVec<T> where
T: Sync,
T: Sync,
impl<T> Unpin for IsizeVec<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for IsizeVec<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,