EntityPropertyTuple

Struct EntityPropertyTuple 

Source
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 all! 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 = all!(Person, Age(42));
// Under the hood this is:
// EntityPropertyTuple::<Person>::new((Age(42),));

Implementations§

Source§

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

Source

pub fn new(inner: T) -> Self

Create a new EntityPropertyTuple wrapping the given tuple.

Source

pub fn inner(&self) -> &T

Returns a reference to the inner tuple.

Source

pub fn into_inner(self) -> T

Consumes self and returns the inner tuple.

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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

Source§

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

Checks that this property list includes all properties in the given list.
Source§

fn set_values_for_entity( &self, entity_id: EntityId<E>, property_store: &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 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>

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_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

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.
Source§

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>

§

impl<E, T> Send for EntityPropertyTuple<E, T>
where T: Send, E: Send,

§

impl<E, T> Sync for EntityPropertyTuple<E, T>
where T: Sync, E: Sync,

§

impl<E, T> Unpin for EntityPropertyTuple<E, T>
where T: Unpin, E: Unpin,

§

impl<E, T> UnwindSafe for EntityPropertyTuple<E, T>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V