Skip to main content

ByteStorage

Trait ByteStorage 

Source
pub trait ByteStorage {
    // Required methods
    fn reset(&mut self);
    fn bytes(&self) -> &[u8] ;
    fn bytes_count(&self) -> usize;
    fn write_bytes(&mut self, bytes: &[u8]);
    fn write_zeros(&mut self, count: usize);

    // Provided method
    fn push_padding(&mut self, alignment: usize) { ... }
}
Expand description

A trait for any storage suitable to store bytes for uniforms.

Required Methods§

Source

fn reset(&mut self)

Clears the storage.

Source

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

Returns a reference to the internal bytes array.

Source

fn bytes_count(&self) -> usize

Returns total number of bytes that is currently in the storage.

Source

fn write_bytes(&mut self, bytes: &[u8])

Writes the given number of bytes to the storage.

Source

fn write_zeros(&mut self, count: usize)

Writes the given number of zero bytes to the storage.

Provided Methods§

Source

fn push_padding(&mut self, alignment: usize)

Writes zeros to ensure that the last byte in the storage has a position that is multiple with the given alignment. The alignment must be power of two.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ByteStorage for Vec<u8>

Source§

fn reset(&mut self)

Source§

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

Source§

fn bytes_count(&self) -> usize

Source§

fn write_bytes(&mut self, bytes: &[u8])

Source§

fn write_zeros(&mut self, count: usize)

Implementors§

Source§

impl<const N: usize> ByteStorage for ArrayVec<u8, N>