[][src]Struct header_slice::vec::HeaderVec

pub struct HeaderVec<H, T> { /* fields omitted */ }

Implementations

impl<H, T> HeaderVec<H, T>[src]

pub fn capacity(&self) -> usize[src]

The total reserved capacity of the vector.

pub fn as_ptr(&self) -> NonNull<HeaderSlice<H, T>>[src]

Returns a pointer to a HeaderSlice representing this vector.

pub fn as_raw_parts(
    &mut self
) -> (NonNull<Pair<H, MaybeUninit<T>>>, usize, usize)
[src]

Returns the raw parts (ptr, length, capacity) of the vector without consuming it. Use at your own risk: it is possible to create multiple instances of the same vector by passing this to from_raw_parts. Having multiple instances with the same pointer is "safe" as long as it is never used mutably (or dropped/consumed) as long as more than one instance exists.

pub fn into_raw_parts(
    mut self: Self
) -> (NonNull<Pair<H, MaybeUninit<T>>>, usize, usize)
[src]

Returns the raw parts (ptr, length, capacity) of the vector. Reconstruct the vector by passing these values to from_raw_parts.

pub unsafe fn from_raw_parts(
    ptr: NonNull<Pair<H, MaybeUninit<T>>>,
    len: usize,
    cap: usize
) -> Self
[src]

Constructs an instance of this struct using the raw parts returned from as_raw_parts or into_raw_parts.

pub fn push(&mut self, val: T)[src]

Push a value to the end of the vector.

pub fn pop(&mut self) -> Option<T>[src]

Pop a value from the end of the vec, if there is one.

pub fn remove(&mut self, index: usize) -> Option<T>[src]

Removes a value at the given index, if it exiss. All entries after index will be shifted to the left.

pub fn swap_remove(&mut self, index: usize) -> Option<T>[src]

Remove an element at index if it exists by replacing it with the last element of the vector.

pub fn insert(&mut self, index: usize, val: T)[src]

Inserts an element at index, shifting all elements after index to the right. Panics if index > self.len()

pub fn with_capacity(head: H, cap: usize) -> Self[src]

Creates an empty HeaderVec with the specified capacity.

pub fn new(head: H) -> Self[src]

Creates an empty HeaderVec.

pub fn truncate(&mut self, new_len: usize)[src]

Shortens the vector to the given length. Panics if new_len > self.len().

pub fn resize_with(&mut self, new_len: usize, mut f: impl FnMut() -> T)[src]

Resizes the vector. If new_len > self.len(), the elements will be instantiated with the given function.

pub fn from_iter<I: IntoIterator<Item = T>>(head: H, iter: I) -> Self[src]

Creates a new instance of HeaderVec from the given header and iterator.

pub fn shrink_to_fit(&mut self)[src]

Reallocates so there is no excess capacity (i.e. capacity == length).

pub fn into_box(mut self: Self) -> Box<HeaderSlice<H, T>>[src]

Converts the vector into a boxed HeaderSlice.

pub fn from_box(src: Box<HeaderSlice<H, T>>) -> Self[src]

Creates a vector from a boxed HeaderSlice.

pub fn reserve(&mut self, additional: usize)[src]

Reserve enough capacity to add at least additional elements without realllocating.

pub fn reserve_exact(&mut self, additional: usize)[src]

Reserve enough capacity to add exactly additional elements without realllocating.

pub fn into_values(self) -> IntoValuesIter<H, T>

Notable traits for IntoValuesIter<H, T>

impl<H, T> Iterator for IntoValuesIter<H, T> type Item = T;
[src]

Consumes the vector and returns an iterator of its values.

pub fn into_header_values(self) -> (H, IntoValuesIter<H, T>)[src]

Consumes the vector and returns its header and an iterator of its values.

pub fn clear(&mut self)[src]

Delete all items in the vector and reallocate so there is no excess capacity.

pub fn clear_in_place(&mut self)[src]

Delete all items in the vector without reallocating.

pub unsafe fn dealloc_without_dropping(mut self: Self)[src]

pub unsafe fn copy_from_ptr_unsafe(head: H, src: *mut T, len: usize) -> Self[src]

Copies the contents of a slice into a new HeaderVec. Do not use or drop the contents of the original slice after this.

impl<H, T> HeaderVec<H, MaybeUninit<T>>[src]

pub fn new_uninit_values(head: H, len: usize) -> Self[src]

pub unsafe fn assume_init_values(self) -> HeaderVec<H, T>[src]

impl<H, T> HeaderVec<MaybeUninit<H>, MaybeUninit<T>>[src]

pub unsafe fn assume_init(self) -> HeaderVec<H, T>[src]

impl<H, T> HeaderVec<MaybeUninit<H>, T>[src]

pub unsafe fn assume_init_head(self) -> HeaderVec<H, T>[src]

impl<H, T: Copy> HeaderVec<H, T>[src]

pub fn copy_from_slice(head: H, src: &[T]) -> Self[src]

Copies the contents of a slice into a new HeaderVec.

pub fn extend_from_slice(&mut self, src: &[T])[src]

Copies the contents onto the end of the vector.

impl<H, T: Clone> HeaderVec<H, T>[src]

pub fn resize(&mut self, new_len: usize, mut val: T)[src]

Resize the vector. If new_len > self.len(), new entries will be cloned from val.

impl<H, T: Default> HeaderVec<H, T>[src]

pub fn resize_default(&mut self, new_len: usize)[src]

Resize the vector. If new_len > self.len(), new entries will use the default value of T.

impl<H, T: Ord> HeaderVec<H, T>[src]

pub fn insert_sorted(&mut self, val: T)[src]

Assuming the vector is sorted, insert the given value into its sorted position. Behavior is undefined if the vector is not sorted.

pub fn insert_or_replace_sorted(&mut self, val: T) -> Option<T>[src]

Assuming the vector is sorted, insert the given value into its sorted position if it does not already exist in the vector. If an element already exists that compares equal to val, reaplce it with val and return its original value. Behavior is undefined if the vector is not sorted.

Methods from Deref<Target = HeaderSlice<H, T>>

pub fn as_truncated(&self, len: usize) -> &Self[src]

pub fn as_truncated_mut(&mut self, len: usize) -> &mut Self[src]

pub unsafe fn resized_unchecked(&mut self, len: usize) -> &mut Self[src]

pub fn len(&self) -> usize[src]

Trait Implementations

impl<H, T, I: IntoIterator<Item = T>> Add<I> for HeaderVec<H, T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<H, T, I: IntoIterator<Item = T>> AddAssign<I> for HeaderVec<H, T>[src]

impl<H, T> AsMut<HeaderSlice<H, T>> for HeaderVec<H, T>[src]

impl<H, T> AsRef<HeaderSlice<H, T>> for HeaderVec<H, T>[src]

impl<H, T> Borrow<HeaderSlice<H, T>> for HeaderVec<H, T>[src]

impl<H, T> BorrowMut<HeaderSlice<H, T>> for HeaderVec<H, T>[src]

impl<H: Clone, T: Clone> Clone for HeaderVec<H, T>[src]

impl<H: Debug, T: Debug> Debug for HeaderVec<H, T>[src]

impl<H: Default, T> Default for HeaderVec<H, T>[src]

impl<H, T> Deref for HeaderVec<H, T>[src]

type Target = HeaderSlice<H, T>

The resulting type after dereferencing.

impl<H, T> DerefMut for HeaderVec<H, T>[src]

impl<H, T> Drop for HeaderVec<H, T>[src]

impl<H: Eq, T: Eq> Eq for HeaderVec<H, T>[src]

impl<H, T> Extend<T> for HeaderVec<H, T>[src]

impl<H, T> From<Box<HeaderSlice<H, T>, Global>> for HeaderVec<H, T>[src]

impl<H: Default, T> FromIterator<T> for HeaderVec<H, T>[src]

impl<H: Hash, T: Hash> Hash for HeaderVec<H, T>[src]

impl<H: Ord, T: Ord> Ord for HeaderVec<H, T>[src]

impl<H, T, Rhs: ?Sized> PartialEq<Rhs> for HeaderVec<H, T> where
    H: PartialEq,
    T: PartialEq,
    Rhs: Borrow<HeaderSlice<H, T>>, 
[src]

impl<H, T, Rhs: ?Sized> PartialOrd<Rhs> for HeaderVec<H, T> where
    H: PartialOrd,
    T: PartialOrd,
    Rhs: Borrow<HeaderSlice<H, T>>, 
[src]

Auto Trait Implementations

impl<H, T> !Send for HeaderVec<H, T>[src]

impl<H, T> !Sync for HeaderVec<H, T>[src]

impl<H, T> Unpin for HeaderVec<H, T>[src]

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<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.