Trait Module

Source
pub trait Module: 'static + Sized {
    type Config: 'static + Sized + Clone + PartialEq + Debug = ();
    type Dependencies: Dependencies = ();

    // Required method
    fn new(config: Self::Config, deps: Self::Dependencies) -> Result<Self>;

    // Provided method
    fn intialize(_handle: Handle<Self>) -> Result<()> { ... }
}
Expand description

A module that is part of an app.

Provided Associated Types§

Source

type Config: 'static + Sized + Clone + PartialEq + Debug = ()

Some initial data that configures the module. Provided by the User when adding a module to an app.

Source

type Dependencies: Dependencies = ()

Other modules that are expected to be part of the app. Provided automatically during app setup, where the program resolves which dependencies each module has.

Required Methods§

Source

fn new(config: Self::Config, deps: Self::Dependencies) -> Result<Self>

creates this module

Provided Methods§

Source

fn intialize(_handle: Handle<Self>) -> Result<()>

Is run once, after all modules have been initialized. This function is optional, it is given a handle to the module itself. other modules can be accessed if you cache the handles to them in the new() function. E.g. the LineRenderer could register its own handle (Handle) with a general Renderer module, if a Handle<Renderer> was part of the Self::Dependencies and cached in the new function. E.g. LineRenderer could have a field renderer: Handle<Renderer> that is populated in new.

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§

Source§

impl Module for Arenas

Source§

impl Module for FlyCam

Source§

impl Module for GraphicsSettingsController

Source§

impl Module for MainCamera3D

Source§

impl Module for Egui

Source§

impl Module for GraphicsContext

Source§

impl Module for Input

Source§

impl Module for ColorMeshRenderer

Source§

impl Module for Gizmos

Source§

impl Module for TextRenderer

Source§

impl Module for UiRectRenderer

Source§

impl Module for WorldRectRenderer

Source§

impl Module for Bloom

Source§

impl Module for AcesToneMapping

Source§

impl Module for Renderer

Source§

impl Module for Scheduler

Source§

impl Module for MainScreenSize

Source§

impl Module for Time

Source§

impl Module for TokioRuntime

Source§

impl Module for FontCache

Source§

impl Module for UiRenderer

Source§

impl Module for WinitMain