pub unsafe trait Std140:
Copy
+ Zeroable
+ Pod {
const ALIGNMENT: usize;
// Provided method
fn as_bytes(&self) -> &[u8] ⓘ { ... }
}Expand description
Trait implemented for all std140 primitives. Generally should not be
implemented outside this crate.
Required Associated Constants§
Sourceconst ALIGNMENT: usize
const ALIGNMENT: usize
The required alignment of the type. Must be a power of two.
This is distinct from the value returned by std::mem::align_of because
AsStd140 structs do not use Rust’s alignment. This enables them to
control and zero their padding bytes, making converting them to and from
slices safe.
Provided Methods§
Sourcefn as_bytes(&self) -> &[u8] ⓘ
fn as_bytes(&self) -> &[u8] ⓘ
Casts the type to a byte array. Implementors should not override this method.
§Safety
This is always safe due to the requirements of bytemuck::Pod being a
prerequisite for this trait.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".