pub struct OffsetVec<V: VecLike> { /* private fields */ }Expand description
For all methods index add a offset
Create from Offset::offset or create
§Examples
use offset_vec::Offset;
let mut vec = vec![0, 1, 2, 3, 4];
let mut vec1 = vec.offset_mut(2);
assert_eq!(vec1, [2, 3, 4]);
assert_eq!(vec1[1], 3);
vec1[1] += 2;
assert_eq!(vec, [0, 1, 2, 5, 4]);Implementations§
Source§impl<V: VecLike> OffsetVec<V>
impl<V: VecLike> OffsetVec<V>
pub fn origin_vec(&self) -> &V
pub fn origin_vec_mut(&mut self) -> &mut V
pub fn into_origin_vec(self) -> V
pub fn as_slice(&self) -> &V::Slice
pub fn as_mut_slice(&mut self) -> &mut V::Slice
pub fn iter<'a>(&'a self) -> <&'a V::Slice as IntoIterator>::IntoIterwhere
&'a V::Slice: IntoIterator,
pub fn iter_mut<'a>(&'a mut self) -> <&'a V::Slice as IntoIterator>::IntoIterwhere
&'a V::Slice: IntoIterator,
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
pub fn reserve(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
pub fn shrink_to_fit(&mut self)
pub fn shrink_to(&mut self, min_capacity: usize)
pub fn origin_offset(&self) -> usize
pub fn push(&mut self, value: V::Elem)
pub fn pop(&mut self) -> Option<V::Elem>
pub fn remove(&mut self, index: usize) -> V::Elem
pub fn insert(&mut self, index: usize, elem: V::Elem)
pub fn truncate(&mut self, len: usize)
pub fn append(&mut self, other: &mut V::Collection)
pub fn clear(&mut self)
pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> V::Drain<'_>
pub fn split_off(&mut self, at: usize) -> V::Collection
pub fn resize(&mut self, new_len: usize, value: V::Elem)
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
pub fn retain<F>(&mut self, f: F)
Source§impl<V: VecLikeSolid> OffsetVec<V>
impl<V: VecLikeSolid> OffsetVec<V>
Trait Implementations§
Source§impl<T, V: VecLike<Slice = [T]>> BorrowMut<[T]> for OffsetVec<V>
impl<T, V: VecLike<Slice = [T]>> BorrowMut<[T]> for OffsetVec<V>
Source§fn borrow_mut(&mut self) -> &mut V::Slice
fn borrow_mut(&mut self) -> &mut V::Slice
Mutably borrows from an owned value. Read more
Source§impl<V: VecLike<Slice = str>> BorrowMut<str> for OffsetVec<V>
impl<V: VecLike<Slice = str>> BorrowMut<str> for OffsetVec<V>
Source§fn borrow_mut(&mut self) -> &mut V::Slice
fn borrow_mut(&mut self) -> &mut V::Slice
Mutably borrows from an owned value. Read more
Source§impl<T, V: VecLike> Extend<T> for OffsetVec<V>where
V::Collection: Extend<T>,
impl<T, V: VecLike> Extend<T> for OffsetVec<V>where
V::Collection: Extend<T>,
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<V: VecLike + IntoIterator> IntoIterator for OffsetVec<V>
impl<V: VecLike + IntoIterator> IntoIterator for OffsetVec<V>
Source§impl<V: VecLike> OffsetCheckRef for OffsetVec<V>
impl<V: VecLike> OffsetCheckRef for OffsetVec<V>
fn offset_check_ref(&self)
Source§impl<V: VecLike> Ord for OffsetVec<V>
impl<V: VecLike> Ord for OffsetVec<V>
Source§impl<T: PartialEq, V: VecLike<Elem = T, Slice = [T]>, const N: usize> PartialEq<&[T; N]> for OffsetVec<V>
impl<T: PartialEq, V: VecLike<Elem = T, Slice = [T]>, const N: usize> PartialEq<&[T; N]> for OffsetVec<V>
Source§impl<T: PartialEq, V: VecLike<Elem = T, Slice = [T]>, const N: usize> PartialEq<[T; N]> for OffsetVec<V>
impl<T: PartialEq, V: VecLike<Elem = T, Slice = [T]>, const N: usize> PartialEq<[T; N]> for OffsetVec<V>
Source§impl<V: VecLike> PartialOrd for OffsetVec<V>where
V::Slice: PartialOrd,
impl<V: VecLike> PartialOrd for OffsetVec<V>where
V::Slice: PartialOrd,
impl<V: VecLike> Eq for OffsetVec<V>
Auto Trait Implementations§
impl<V> Freeze for OffsetVec<V>where
V: Freeze,
impl<V> RefUnwindSafe for OffsetVec<V>where
V: RefUnwindSafe,
impl<V> Send for OffsetVec<V>where
V: Send,
impl<V> Sync for OffsetVec<V>where
V: Sync,
impl<V> Unpin for OffsetVec<V>where
V: Unpin,
impl<V> UnwindSafe for OffsetVec<V>where
V: 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