Trait crevice::std140::Std140

source ·
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§

source

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§

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Std140 for f32

source§

const ALIGNMENT: usize = 4usize

source§

impl Std140 for f64

source§

const ALIGNMENT: usize = 8usize

source§

impl Std140 for i32

source§

const ALIGNMENT: usize = 4usize

source§

impl Std140 for u32

source§

const ALIGNMENT: usize = 4usize

Implementors§

source§

impl Std140 for BVec2

source§

const ALIGNMENT: usize = 8usize

source§

impl Std140 for BVec3

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for BVec4

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Bool

source§

const ALIGNMENT: usize = 4usize

source§

impl Std140 for DMat2

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for DMat3

source§

const ALIGNMENT: usize = 32usize

source§

impl Std140 for DMat4

source§

const ALIGNMENT: usize = 32usize

source§

impl Std140 for DVec2

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for DVec3

source§

const ALIGNMENT: usize = 32usize

source§

impl Std140 for DVec4

source§

const ALIGNMENT: usize = 32usize

source§

impl Std140 for IVec2

source§

const ALIGNMENT: usize = 8usize

source§

impl Std140 for IVec3

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for IVec4

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Mat2

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Mat3

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Mat4

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for UVec2

source§

const ALIGNMENT: usize = 8usize

source§

impl Std140 for UVec3

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for UVec4

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Vec2

source§

const ALIGNMENT: usize = 8usize

source§

impl Std140 for Vec3

source§

const ALIGNMENT: usize = 16usize

source§

impl Std140 for Vec4

source§

const ALIGNMENT: usize = 16usize

source§

impl<T: Std140> Std140 for DynamicUniformStd140<T>