Skip to main content

Holds

Trait Holds 

Source
pub trait Holds<T>: From<T> { }
Expand description

Proves that a set holds T, and turns a T into it.

Written by meshes!, surface_styles! and post_effects! for every type they name. Every call that takes a value of a game’s own set is bound by it: draw, both prepare calls, Instance::surface_style, set_surface_style and set_post_effect. A game spells one bound per type, in its own code that draws, or sets a style or effect, for any Game.

use mirage_engine::prelude::*;

fn draw_cube<G: Game>(ctx: &mut FrameContext<'_, G>, at: Vec3)
where
    G::Meshes: Holds<Cube>,
{
    ctx.draw(Cube.at(at));
}

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§