Skip to main content

FrameBuffer

Trait FrameBuffer 

Source
pub trait FrameBuffer {
    type BufferSlice: AsMut<[u8]> + AsRef<[u8]> + Truncate;

    // Required method
    fn allocate(&mut self, size: usize) -> Result<&mut Self::BufferSlice>;
}
Expand description

Representation of a frame buffer which allows to allocate continuous slices of memory as bytes Already implemented for Vec<u8>

Required Associated Types§

Source

type BufferSlice: AsMut<[u8]> + AsRef<[u8]> + Truncate

The type representing a slice of the buffer.

Required Methods§

Source

fn allocate(&mut self, size: usize) -> Result<&mut Self::BufferSlice>

Tries to allocate a continuous slice of memory in the buffer. If allocation fails an crate::error::SframeError is returned.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl FrameBuffer for Vec<u8>

Source§

type BufferSlice = Vec<u8>

Source§

fn allocate(&mut self, size: usize) -> Result<&mut Self::BufferSlice>

Implementors§