Trait Vertex

Source
pub unsafe trait Vertex {
    type Projection: Projection + 'static;

    const DEF: Define<VectorType>;
}
Expand description

The vertex type description.

§Safety

The fields of Define must exactly match the actual struct fields. To do this, the fields must be ordered, so the struct must have the #[repr(C)] attribute and the fields must have the same order as specified in Define.

§Deriving

Although the library tries to formalize the safety invariant, you still shouldn’t implement the vertex yourself. The most reliable and simple way to do this is to use a derive macro:

use dunge::Vertex;

#[repr(C)]
#[derive(Vertex)]
struct Vert {
    pos: [f32; 2],
    col: [f32; 3],
}

Required Associated Constants§

Required Associated Types§

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§