Trait bevy::render::render_resource::std140::WriteStd140
[−]pub trait WriteStd140 {
fn write_std140<W>(&self, writer: &mut Writer<W>) -> Result<usize, Error>
where
W: Write;
fn std140_size(&self) -> usize { ... }
}
Expand description
Trait implemented for all types that can be written into a buffer as
std140
bytes. This type is more general than AsStd140
: all AsStd140
types implement WriteStd140
, but not the other way around.
While AsStd140
requires implementers to return a type that implements the
Std140
trait, WriteStd140
directly writes bytes using a Writer
. This
makes WriteStd140
usable for writing slices or other DSTs that could not
implement AsStd140
without allocating new memory on the heap.
Required methods
Writes this value into the given Writer
using std140
layout rules.
Should return the offset of the first byte of this type, as returned by
the first call to Writer::write
.
Provided methods
fn std140_size(&self) -> usize
fn std140_size(&self) -> usize
The space required to write this value using std140
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.