Skip to main content

VecAllocExt

Trait VecAllocExt 

Source
pub trait VecAllocExt<T, A: Allocator>: Sized + Sealed {
    // Required methods
    fn try_with_capacity_in(
        capacity: usize,
        alloc: A,
    ) -> Result<Self, AllocError>;
    fn try_push(&mut self, value: T) -> Result<(), AllocError>;
    fn try_resize(&mut self, new_len: usize, value: T) -> Result<(), AllocError>
       where T: Copy;
    fn try_resize_with<F>(
        &mut self,
        new_len: usize,
        f: F,
    ) -> Result<(), AllocError>
       where F: FnMut() -> T;
    fn try_copy_from_slice(&mut self, other: &[T]) -> Result<(), AllocError>
       where T: Copy;
}
Expand description

Extension for Vec<T, A>

Required Methods§

Source

fn try_with_capacity_in(capacity: usize, alloc: A) -> Result<Self, AllocError>

Source

fn try_push(&mut self, value: T) -> Result<(), AllocError>

Source

fn try_resize(&mut self, new_len: usize, value: T) -> Result<(), AllocError>
where T: Copy,

Source

fn try_resize_with<F>(&mut self, new_len: usize, f: F) -> Result<(), AllocError>
where F: FnMut() -> T,

Source

fn try_copy_from_slice(&mut self, other: &[T]) -> Result<(), AllocError>
where T: Copy,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, A: Allocator> VecAllocExt<T, A> for Vec<T, A>

Source§

fn try_with_capacity_in(capacity: usize, alloc: A) -> Result<Self, AllocError>

Source§

fn try_push(&mut self, value: T) -> Result<(), AllocError>

Source§

fn try_resize(&mut self, new_len: usize, value: T) -> Result<(), AllocError>
where T: Copy,

Source§

fn try_resize_with<F>(&mut self, new_len: usize, f: F) -> Result<(), AllocError>
where F: FnMut() -> T,

Source§

fn try_copy_from_slice(&mut self, other: &[T]) -> Result<(), AllocError>
where T: Copy,

Implementors§