Skip to main content

Part

Trait Part 

Source
pub trait Part:
    Hash
    + Eq
    + Clone
    + Debug {
    // Required methods
    fn from_name(name: &str) -> Option<Self>;
    fn all() -> Vec<Self>;
    fn index(&self) -> u32;
}
Expand description

A name for one repaintable part of a mesh.

Required if you want to repaint one part of a mesh and leave the rest: derive it on an enum whose variants are the loaded mesh’s material names, and name that enum where the mesh implements Mesh.

Required Methods§

Source

fn from_name(name: &str) -> Option<Self>

The part the material name resolves to, or None to leave that material as authored, which no draw repaints on its own.

Source

fn all() -> Vec<Self>

Every part, in the order index counts them.

Each of them must resolve exactly one material of every loaded mesh built over this vocabulary; otherwise startup fails.

Source

fn index(&self) -> u32

This part’s position in all.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§