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§
Sourcefn get_query(&self) -> Vec<(usize, HashValueType)>
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().
Sourcefn get_type_ids(&self) -> Vec<TypeId>
fn get_type_ids(&self) -> Vec<TypeId>
Returns an unordered list of type IDs of the properties in this query.
Sourcefn multi_property_value_hash(&self) -> HashValueType
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.
Sourcefn new_query_result_iterator<'c>(
&self,
context: &'c Context,
) -> EntitySetIterator<'c, E> ⓘ
fn new_query_result_iterator<'c>( &self, context: &'c Context, ) -> EntitySetIterator<'c, E> ⓘ
Creates a new EntitySetIterator.
Sourcefn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool
fn match_entity(&self, entity_id: EntityId<E>, context: &Context) -> bool
Determines if the given person matches this query.
Sourcefn filter_entities(&self, entities: &mut Vec<EntityId<E>>, context: &Context)
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§
Sourcefn multi_property_id(&self) -> Option<usize>
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.