[−][src]Struct rinecs::operators::ReadRef
Operator that matches entities that contain a component through a reference
A reference to another entity is any component that implements
Deref<Target=Entity>
The first parameter to ReadRef indicates the reference component the second the referenced
#[derive(Component, Debug)] struct Position(f32,f32); #[derive(Component, Debug)] struct GeometryRef(Entity); #[derive(Component, Debug)] struct Geometry; let geom = world.new_entity() .add(Geometry) .build(); world.new_entity() .add(GeometryRef(geom)) .add(Position(0., 0.)) .build(); world.new_entity() .add(GeometryRef(geom)) .add(Position(10., 10.)) .build(); for (geom, pos) in entities.iter_for::<(ReadRef<GeometryRef, Geometry>, Read<Position>)>(){ // draw geometry at position }
Will select all entities that reference a Geometry through a GeometryRef and have a position then draw the geometry at that position.
This allow to have only one copy of the geometry that is referenced by multiple entities
When deriving Component for a tuple struct with only one element it'll also derive Deref for that element so in this case GeometryRef automatically can be used with ReadRef
Trait Implementations
impl<'a, T, Ref> UnorderedData<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentSend,
Ref: Component + Send,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
[src]
impl<'a, T, Ref> UnorderedData<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentSend,
Ref: Component + Send,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
type Iter = ReadRefIter<'a, Self::Storage, <Ref as Component>::Storage, Ref>
type Components = Option<Ref>
type ComponentsRef = Option<<<Ref as Component>::Storage as Storage<'a, Ref>>::Get>
type Storage = StorageReadRef<'a, <T as Component>::Storage, T, <Ref as Component>::Storage, Ref>
fn components_mask(entities: Entities<'a>) -> Bitmask
[src]
fn components_mask(entities: Entities<'a>) -> Bitmask
fn into_iter(entities: Entities<'a>) -> Self::Iter
[src]
fn into_iter(entities: Entities<'a>) -> Self::Iter
fn storage(entities: Entities<'a>) -> Self::Storage
[src]
fn storage(entities: Entities<'a>) -> Self::Storage
impl<'a, T, Ref> ParUnorderedData<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentSend,
Ref: Component + Send,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
[src]
impl<'a, T, Ref> ParUnorderedData<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentSend,
Ref: Component + Send,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
type ParIter = ReadStorageParIter<'a, Self::ComponentsRef, Self::Storage>
fn into_pariter(entities: Entities<'a>) -> Self::ParIter
[src]
fn into_pariter(entities: Entities<'a>) -> Self::ParIter
impl<'a, T, Ref> UnorderedDataLocal<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentThreadLocal,
Ref: Component,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
[src]
impl<'a, T, Ref> UnorderedDataLocal<'a> for ReadRef<'a, T, Ref> where
T: 'a + NToOneComponentThreadLocal,
Ref: Component,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
type Iter = ReadRefIter<'a, Self::Storage, <Ref as Component>::Storage, Ref>
type Components = Option<Ref>
type ComponentsRef = Option<<<Ref as Component>::Storage as Storage<'a, Ref>>::Get>
type Storage = StorageReadRefLocal<'a, <T as Component>::Storage, T, <Ref as Component>::Storage, Ref>
fn components_mask_thread_local(entities: EntitiesThreadLocal<'a>) -> Bitmask
[src]
fn components_mask_thread_local(entities: EntitiesThreadLocal<'a>) -> Bitmask
fn into_iter_thread_local(entities: EntitiesThreadLocal<'a>) -> Self::Iter
[src]
fn into_iter_thread_local(entities: EntitiesThreadLocal<'a>) -> Self::Iter
fn storage_thread_local(entities: EntitiesThreadLocal<'a>) -> Self::Storage
[src]
fn storage_thread_local(entities: EntitiesThreadLocal<'a>) -> Self::Storage
impl<'a, T: 'a + NToOneComponent, Ref: 'a + Component> FromComponent<'a, &'a Ref> for ReadRef<'a, T, Ref>
[src]
impl<'a, T: 'a + NToOneComponent, Ref: 'a + Component> FromComponent<'a, &'a Ref> for ReadRef<'a, T, Ref>
fn from_component(component: &'a Ref) -> ReadRef<'a, T, Ref>
[src]
fn from_component(component: &'a Ref) -> ReadRef<'a, T, Ref>
impl<'a, T: 'a + NToOneComponent, Ref: 'a + Component> Deref for ReadRef<'a, T, Ref>
[src]
impl<'a, T: 'a + NToOneComponent, Ref: 'a + Component> Deref for ReadRef<'a, T, Ref>
Auto Trait Implementations
impl<'a, T, Ref> Send for ReadRef<'a, T, Ref> where
Ref: Sync,
T: Sync,
impl<'a, T, Ref> Send for ReadRef<'a, T, Ref> where
Ref: Sync,
T: Sync,
impl<'a, T, Ref> Sync for ReadRef<'a, T, Ref> where
Ref: Sync,
T: Sync,
impl<'a, T, Ref> Sync for ReadRef<'a, T, Ref> where
Ref: Sync,
T: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<U, T> AsUniform for U where
T: AsUniform<[f32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[f32; 3]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 2]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<u32>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<u32>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 2]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[[f32; 4]; 4]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[[f32; 4]; 4]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 4]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[i32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[i32; 3]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[[f32; 3]; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[[f32; 3]; 3]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<i32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<i32> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 4]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[f32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[f32; 2]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[i32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[i32; 2]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[[f32; 4]; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[[f32; 4]; 4]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<i32>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<i32>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[u32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[u32; 2]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<u32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<u32> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 3]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[f32; 2]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[u32; 3]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 3]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[u32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[u32; 3]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<[i32; 4]> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<[[f32; 3]; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<[[f32; 3]; 3]>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<f32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform for U where
T: AsUniform<dyn AsRef<f32> + 'static>,
U: Deref<Target = T>,
fn as_uniform(&self) -> UniformValue
[src]
fn as_uniform(&self) -> UniformValue
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SetParameter for T
[src]
impl<T> SetParameter for T