pub struct IsizeVec<T> { /* private fields */ }
Expand description
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);
}
Implementations§
Source§impl<T> IsizeVec<T>
impl<T> IsizeVec<T>
Sourcepub fn push(&mut self, item: T) -> usize
pub fn push(&mut self, item: T) -> usize
Push a value to the end of the vector, with relative: isize::MAX
.
Sourcepub fn first_positive(&self) -> usize
pub fn first_positive(&self) -> usize
Find the index at which positive elements start.
Sourcepub fn insert(&mut self, relative: isize, item: T) -> usize
pub fn insert(&mut self, relative: isize, item: T) -> usize
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.
Sourcepub fn first_right_of(&self, relative: isize) -> usize
pub fn first_right_of(&self, relative: isize) -> usize
Find the first index to the right of the relative list.
Trait Implementations§
Source§impl<'a, T> IntoIterator for &'a IsizeVec<T>
impl<'a, T> IntoIterator for &'a IsizeVec<T>
Source§impl<'a, T> IntoIterator for &'a mut IsizeVec<T>
impl<'a, T> IntoIterator for &'a mut IsizeVec<T>
Auto Trait Implementations§
impl<T> Freeze for IsizeVec<T>
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§
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