Skip to main content

Buffer

Trait Buffer 

Source
pub trait Buffer {
    // Required methods
    fn as_bytes(&self) -> &[u8] ;
    fn as_bytes_mut(&mut self) -> &mut [u8] ;
}
Expand description

Trait for Scratchpad buffer types.

Buffer objects contain the memory from which Scratchpad allocations are made. Scratchpad handles all bookkeeping, so a buffer only needs to provide methods for raw access of the buffer memory.

Required Methods§

Source

fn as_bytes(&self) -> &[u8]

Returns a byte slice of the buffer contents.

Source

fn as_bytes_mut(&mut self) -> &mut [u8]

Returns a mutable byte slice of the buffer contents.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a, T> Buffer for &'a mut [T]
where T: ByteData,

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<T> Buffer for Box<[T]>
where T: ByteData,

Available on crate features alloc or std or unstable only.
Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Implementors§

Source§

impl<T> Buffer for T
where T: Array, <T as Array>::Item: ByteData,