pub struct EntityPropertyTuple<E: Entity, T> { /* private fields */ }Expand description
A newtype wrapper that associates a tuple of property values with an entity type.
This is not meant to be used directly, but rather as a backing for the with! macro/ a replacement for the query tuple.
§Example
ⓘ
use ixa::{EntityPropertyTuple, define_entity, define_property};
define_entity!(Person);
define_property!(struct Age(u8), Person, default_const = Age(0));
// Use the all macro
let query = with!(Person, Age(42));
// Under the hood this is:
// EntityPropertyTuple::<Person>::new((Age(42),));Implementations§
Trait Implementations§
Source§impl<E: Entity, T: PropertyList<E>> PropertyList<E> for EntityPropertyTuple<E, T>
impl<E: Entity, T: PropertyList<E>> PropertyList<E> for EntityPropertyTuple<E, T>
Source§fn validate() -> Result<(), IxaError>
fn validate() -> Result<(), IxaError>
Validates that the properties are distinct. If not, returns an error describing the problematic properties.
Source§fn contains_properties(property_type_ids: &[TypeId]) -> bool
fn contains_properties(property_type_ids: &[TypeId]) -> bool
Checks that this property list includes all properties in the given list.
Source§fn set_values_for_new_entity(
&self,
entity_id: EntityId<E>,
property_store: &mut PropertyStore<E>,
)
fn set_values_for_new_entity( &self, entity_id: EntityId<E>, property_store: &mut PropertyStore<E>, )
Assigns the given entity the property values in
self in the property_store.
This method does NOT emit property change events, as it is called upon entity creation.Source§fn get_values_for_entity(context: &Context, entity_id: EntityId<E>) -> Self
fn get_values_for_entity(context: &Context, entity_id: EntityId<E>) -> Self
Gets the tuple of property values for the given entity.
Source§fn contains_required_properties() -> bool
fn contains_required_properties() -> bool
Checks that this property list contains all required properties of the entity.
Source§impl<E: Entity, T: Query<E>> Query<E> for EntityPropertyTuple<E, T>
impl<E: Entity, T: Query<E>> Query<E> for EntityPropertyTuple<E, T>
Source§fn 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().Source§fn 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.
Source§fn 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.Source§fn 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.
Source§fn new_query_result<'c>(&self, context: &'c Context) -> EntitySet<'c, E>
fn new_query_result<'c>(&self, context: &'c Context) -> EntitySet<'c, E>
Creates a new query result as an
EntitySet.Source§fn 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.
Source§fn 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.Source§fn 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.impl<E: Entity, T: Copy> Copy for EntityPropertyTuple<E, T>
Auto Trait Implementations§
impl<E, T> Freeze for EntityPropertyTuple<E, T>where
T: Freeze,
impl<E, T> RefUnwindSafe for EntityPropertyTuple<E, T>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, T> Send for EntityPropertyTuple<E, T>
impl<E, T> Sync for EntityPropertyTuple<E, T>
impl<E, T> Unpin for EntityPropertyTuple<E, T>
impl<E, T> UnwindSafe for EntityPropertyTuple<E, T>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more