Trait moonshine_object::ObjectInstance

source ·
pub trait ObjectInstance<T: Kind = Any> {
    // Required method
    fn instance(&self) -> Instance<T>;

    // Provided method
    fn entity(&self) -> Entity { ... }
}

Required Methods§

source

fn instance(&self) -> Instance<T>

Returns the Instance of this object.

§Example

let mut app = App::new();
// ...
app.add_systems(Update, print_instances);

fn print_instances(objects: Objects) {
    for object in objects.iter() {
        println!("{:?}", object.instance());
    }
}

Provided Methods§

source

fn entity(&self) -> Entity

Returns the Entity of this object.

Implementors§

source§

impl<'w, 's, 'a, T: Kind> ObjectInstance<T> for Object<'w, 's, 'a, T>

source§

impl<'w, 's, 'a, T: Kind> ObjectInstance<T> for ObjectRef<'w, 's, 'a, T>