Trait ggez::context::Has

source ·
pub trait Has<T> {
    // Required method
    fn retrieve(&self) -> &T;
}
Expand description

Used to represent types that can provide a certain context type.

If you don’t know what this is, you most likely want to pass ctx.

This trait is basically syntactical sugar, saving you from having to split contexts when you don’t need to and also shortening calls like

canvas.finish(&mut ctx.gfx)?;

into just

canvas.finish(ctx)?;

Required Methods§

source

fn retrieve(&self) -> &T

Method to retrieve the context type.

Implementors§