[][src]Trait generic_vec::raw::Storage

pub unsafe trait Storage<T> {
    pub fn is_valid_storage() -> bool;
pub fn capacity(&self) -> usize;
pub fn as_ptr(&self) -> *const T;
pub fn as_mut_ptr(&mut self) -> *mut T;
pub fn reserve(&mut self, new_capacity: usize);
pub fn try_reserve(&mut self, new_capacity: usize) -> Result<(), AllocError>; }

A type that can hold Ts, and potentially reserve space for more Self::Itemss

Required methods

pub fn is_valid_storage() -> bool[src]

Returns true if the this storage can hold types T

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

The number of elements that it is valid to write to this Storage

i.e. as_mut_ptr()..as_mut_ptr() + capacity() should be valid to write Ts

pub fn as_ptr(&self) -> *const T[src]

Returns a pointer to the first element

pub fn as_mut_ptr(&mut self) -> *mut T[src]

Returns a mutable pointer to the first element

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

Reserves space for at least new_capacity elements

Safety

After this call successfully ends, the capacity must be at least new_capacity

Panic/Abort

Maybe panic or abort if it is impossible to set the capacity to at least new_capacity

pub fn try_reserve(&mut self, new_capacity: usize) -> Result<(), AllocError>[src]

Tries to reserve space for at least new_capacity elements

Returns Ok(()) on success, Err(AllocError) if it is impossible to set the capacity to at least new_capacity

Safety

If Ok(()) is returned, the capacity must be at least new_capacity

Loading content...

Implementations on Foreign Types

impl<T, S: ?Sized + Storage<T>, '_> Storage<T> for &'_ mut S[src]

impl<T, S: ?Sized + Storage<T>> Storage<T> for Box<S>[src]

Loading content...

Implementors

impl<T> Storage<T> for ZeroSized[src]

impl<T, U> Storage<U> for Heap<T>[src]

impl<T, U, '_> Storage<U> for UninitSlice<'_, T>[src]

impl<T: Copy, '_> Storage<T> for Slice<'_, T>[src]

impl<T: Copy, const N: usize> Storage<T> for Array<T, N>[src]

impl<U, T, const N: usize> Storage<U> for UninitArray<T, N>[src]

Loading content...