Query

Trait Query 

Source
pub trait Query<E: Entity>: Copy + 'static {
    // Required methods
    fn get_query(&self) -> Vec<(usize, HashValueType)>;
    fn get_type_ids(&self) -> Vec<TypeId>;
    fn multi_property_value_hash(&self) -> HashValueType;
    fn new_query_result_iterator<'c>(
        &self,
        context: &'c Context,
    ) -> EntitySetIterator<'c, E> ;
    fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool;
    fn filter_entities(
        &self,
        entities: &mut Vec<EntityId<E>>,
        context: &Context,
    );

    // Provided method
    fn multi_property_id(&self) -> Option<usize> { ... }
}
Expand description

Encapsulates a query.

ContextEntitiesExt::query_result_iterator actually takes an instance of Query, but because we implement Query for tuples of up to size 20, that’s invisible to the caller. Do not use this trait directly.

Required Methods§

Source

fn get_query(&self) -> Vec<(usize, HashValueType)>

Returns a list of (type_id, hash) pairs where hash is the hash of the property value and type_id is Property.type_id().

Source

fn get_type_ids(&self) -> Vec<TypeId>

Returns an unordered list of type IDs of the properties in this query.

Source

fn multi_property_value_hash(&self) -> HashValueType

If this query is a multi-property query, this method computes the hash of the multi-property value.

Source

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Creates a new EntitySetIterator.

Source

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Determines if the given person matches this query.

Source

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Removes all EntityIds from the given vector that do not match this query.

Provided Methods§

Source

fn multi_property_id(&self) -> Option<usize>

Returns the TypeId of the multi-property having the properties of this query, if any.

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.

Implementations on Foreign Types§

Source§

impl<E: Entity> Query<E> for ()

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_id(&self) -> Option<usize>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, _entity_id: EntityId<E>, _context: &Context) -> bool

Source§

fn filter_entities(&self, _entities: &mut Vec<EntityId<E>>, _context: &Context)

Source§

impl<E: Entity, P1: Property<E>> Query<E> for (P1,)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_id(&self) -> Option<usize>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>> Query<E> for (T0, T1)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>> Query<E> for (T0, T1, T2)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>> Query<E> for (T0, T1, T2, T3)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>, T4: Property<E>> Query<E> for (T0, T1, T2, T3, T4)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>, T4: Property<E>, T5: Property<E>> Query<E> for (T0, T1, T2, T3, T4, T5)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>, T4: Property<E>, T5: Property<E>, T6: Property<E>> Query<E> for (T0, T1, T2, T3, T4, T5, T6)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>, T4: Property<E>, T5: Property<E>, T6: Property<E>, T7: Property<E>> Query<E> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Source§

impl<E: Entity, T0: Property<E>, T1: Property<E>, T2: Property<E>, T3: Property<E>, T4: Property<E>, T5: Property<E>, T6: Property<E>, T7: Property<E>, T8: Property<E>> Query<E> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Source§

fn get_query(&self) -> Vec<(usize, HashValueType)>

Source§

fn get_type_ids(&self) -> Vec<TypeId>

Source§

fn multi_property_value_hash(&self) -> HashValueType

Source§

fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E>

Source§

fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool

Source§

fn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)

Implementors§

Source§

impl<E: Entity, T: Query<E>> Query<E> for EntityPropertyTuple<E, T>