Trait VertexTrait

Source
pub trait VertexTrait: Copy + 'static {
    // Required method
    fn layout() -> &'static [VertexAttributeDescriptor];
}
Expand description

A common trait for all vertex types. IMPORTANT: Implementors must use #[repr(C)] attribute, otherwise the compiler is free to reorder fields and you might get weird results, because definition order will be different from memory order! See examples in VertexBuffer docs.

Required Methods§

Source

fn layout() -> &'static [VertexAttributeDescriptor]

Returns memory layout of the vertex. It basically tells a GPU how to interpret every byte range of your vertex type; which kind of information it holds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§