Trait GameObject

Source
pub trait GameObject: Any + Debug {
    // Required methods
    fn component_infos() -> ComponentVec<ComponentInfo>;
    fn components(&self) -> ComponentVec<(TypeId, &[u8])>;
}
Expand description

Trait that game object types implement to be able to be added to a Scene. Impl generated with impl_game_object.

Required Methods§

Source

fn component_infos() -> ComponentVec<ComponentInfo>

Returns the allocation and type comparison details for the components of this game object type.

The order of the infos is the same as GameObject::components.

Source

fn components(&self) -> ComponentVec<(TypeId, &[u8])>

Returns a single game object’s components as anonymous byte slices, with the type id for component type detection.

The order of the components is the same as GameObject::component_infos.

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§