[][src]Trait storages::buffer::Buffer

pub trait Buffer<T: ?Sized> {
    type ExternalData: ?Sized;
    pub fn as_ptr(&self, data: &Self::ExternalData) -> *const T;
pub fn as_mut_ptr(&mut self, data: &Self::ExternalData) -> *mut T; }

Backend for collection types like Box and Vec.

Every buffer may require an external datum, which is passed every time the buffer is accessed. This way the implementation does not require the data to store which might save some memory.

Associated Types

type ExternalData: ?Sized[src]

Data required to be passed at every interaction with the buffer.

Loading content...

Required methods

pub fn as_ptr(&self, data: &Self::ExternalData) -> *const T[src]

Returns a shared pointer to the buffered datum.

pub fn as_mut_ptr(&mut self, data: &Self::ExternalData) -> *mut T[src]

Returns a unique pointer to the buffered datum.

Loading content...

Implementors

impl<T, A: ?Sized + AllocRef> Buffer<MaybeUninit<T>> for AllocatedBuffer<T, A>[src]

type ExternalData = A

impl<T, A: ?Sized + AllocRef> Buffer<[MaybeUninit<T>]> for AllocatedBuffer<[T], A>[src]

type ExternalData = A

impl<T, const N: usize> Buffer<[T]> for [MaybeUninit<T>; N][src]

type ExternalData = ()

impl<T, const N: usize> Buffer<[T]> for [T; N][src]

type ExternalData = ()

impl<T: ?Sized, A: ?Sized + AllocRef> Buffer<T> for AllocatedBuffer<T, A>[src]

type ExternalData = A

Loading content...