logo

Trait bevy::render::render_resource::std430::WriteStd430[]

pub trait WriteStd430 {
    fn write_std430<W>(&self, writer: &mut Writer<W>) -> Result<usize, Error>
    where
        W: Write
; fn std430_size(&self) -> usize { ... } }
Expand description

Trait implemented for all types that can be written into a buffer as std430 bytes. This type is more general than AsStd430: all AsStd430 types implement WriteStd430, but not the other way around.

While AsStd430 requires implementers to return a type that implements the Std430 trait, WriteStd430 directly writes bytes using a Writer. This makes WriteStd430 usable for writing slices or other DSTs that could not implement AsStd430 without allocating new memory on the heap.

Required methods

Writes this value into the given Writer using std430 layout rules.

Should return the offset of the first byte of this type, as returned by the first call to Writer::write.

Provided methods

The space required to write this value using std430 layout rules. This does not include alignment padding that may be needed before or after this type when written as part of a larger buffer.

Implementations on Foreign Types

Implementors