[][src]Struct isize_vec::IsizeVec

pub struct IsizeVec<T> { /* fields omitted */ }

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]

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]

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]

type Output = <I as SliceIndex<[T]>>::Output

The returned type after indexing.

impl<T, I> IndexMut<I> for IsizeVec<T> where
    I: SliceIndex<[T]>, 
[src]

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?

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?

impl<'a, T> IntoIterator for &'a mut IsizeVec<T>[src]

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<T> RefUnwindSafe for IsizeVec<T> where
    T: RefUnwindSafe

impl<T> Send for IsizeVec<T> where
    T: Send

impl<T> Sync for IsizeVec<T> where
    T: Sync

impl<T> Unpin for IsizeVec<T> where
    T: Unpin

impl<T> UnwindSafe for IsizeVec<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.