Skip to main content

BufferSource

Trait BufferSource 

Source
pub trait BufferSource {
    // Required methods
    unsafe fn to_buffer_ref(&self) -> Buffer;
    unsafe fn to_buffer_mut(&mut self) -> BufferMut;
}
Expand description

Converts a generated storage item into the BufferRef used by dispatch.

Input: a raw pointer to the generated storage item. Output: a BufferRef pointing at the buffer bytes.

Required Methods§

Source

unsafe fn to_buffer_ref(&self) -> Buffer

Builds a BufferRef from a raw pointer to the implementing type.

Input: pointer to converter-generated storage. Output: buffer pointer and byte length.

Safety: ptr must point to a valid value of Self.

Source

unsafe fn to_buffer_mut(&mut self) -> BufferMut

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<const N: usize> BufferSource for [u8; N]

Source§

unsafe fn to_buffer_ref(&self) -> Buffer

Treats a static byte array as a buffer buffer.

Input: pointer to [u8; N]. Output: BufferRef with the array pointer and fixed length N.

Safety: ptr must point to a valid byte array.

Source§

unsafe fn to_buffer_mut(&mut self) -> BufferMut

Implementors§