Skip to main content

QueryComponent

Trait QueryComponent 

Source
pub trait QueryComponent {
    type Item<'world>: QueryComponent;

    // Required methods
    fn get_component_ids() -> Vec<ComponentId> ;
    fn get_component<'world>(
        world: UnsafeWorldCell<'world>,
        entity_id: EntityId,
    ) -> Self::Item<'world>;
}

Required Associated Types§

Required Methods§

Source

fn get_component_ids() -> Vec<ComponentId>

Source

fn get_component<'world>( world: UnsafeWorldCell<'world>, entity_id: EntityId, ) -> Self::Item<'world>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<C> QueryComponent for &C
where C: Component + 'static,

Source§

type Item<'world> = &'world C

Source§

fn get_component_ids() -> Vec<ComponentId>

Source§

fn get_component<'world>( world: UnsafeWorldCell<'world>, entity_id: EntityId, ) -> Self::Item<'world>

Source§

impl<C> QueryComponent for &mut C
where C: Component + 'static,

Source§

type Item<'world> = &'world mut C

Source§

fn get_component_ids() -> Vec<ComponentId>

Source§

fn get_component<'world>( world: UnsafeWorldCell<'world>, entity_id: EntityId, ) -> Self::Item<'world>

Source§

impl<T1> QueryComponent for (T1,)
where T1: QueryComponent,

Source§

type Item<'world> = (<T1 as QueryComponent>::Item<'world>,)

Source§

fn get_component_ids() -> Vec<ComponentId>

Source§

fn get_component<'world>( world: UnsafeWorldCell<'world>, entity_id: EntityId, ) -> Self::Item<'world>

Implementors§