Struct rin::ecs::operators::URef [−][src]
pub struct URef<'a, T, R> where
T: OneToOneComponent<'a>, { /* fields omitted */ }
Matches a component in another entity referenced through a component that Derefs to an Entity:
Entity A Entity C
Component(Entity) ───────────────► AnotherCompoenent
Entity B Entity D
Component(Entity) ───────────────► AnotherCompoenent
Allows to create OneToOne relations between entities components.
In the following example we create 2 entities that reference their geometry from other entities.
References have to implement OneToOneComponent.
As opposed to Ref and NToOneComponent this operator returns a plain iterator for write access to the referenced component since OneToOneComponent ensures that the references are unique and so the iterator won’t ever access the same component mutably more than once.
#[derive(Debug)] struct Vertex; #[derive(OneToOneComponent, Debug, Hash)] struct GeometryRef(Entity); #[derive(Component, Debug)] struct Geometry(Vec<Vertex>); #[derive(Component, Debug)] struct Position{x: f32, y: f32}; let mut world = World::new(); let geometry1 = world.new_entity().add(Geometry(vec![Vertex, Vertex, Vertex])).build(); let geometry2 = world.new_entity().add(Geometry(vec![Vertex, Vertex, Vertex])).build(); let a = world.new_entity() .add(GeometryRef(geometry1)) .add(Position{x: 0.0, y: 0.0}) .build(); let b = world.new_entity() .add(GeometryRef(geometry2)) .add(Position{x: 0.0, y: 0.0}) .build(); for geometry in world.iter_for_mut::<URef<GeometryRef, Write<Geometry>>>() { }
Trait Implementations
impl<'a, T, R> DataAccesses for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: DataAccesses,
[src]
impl<'a, T, R> DataAccesses for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: DataAccesses,
[src]impl<'a, T, R> Deref for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a>,
[src]
impl<'a, T, R> Deref for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a>,
[src]impl<'a, T, R> DerefMut for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a>,
[src]
impl<'a, T, R> DerefMut for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a>,
[src]impl<'a, T, R> FromComponent<'a, <R as UnorderedData<'a>>::ComponentsRef> for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a> + FromComponent<'a, <R as UnorderedData<'a>>::ComponentsRef>,
[src]
impl<'a, T, R> FromComponent<'a, <R as UnorderedData<'a>>::ComponentsRef> for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: UnorderedData<'a> + FromComponent<'a, <R as UnorderedData<'a>>::ComponentsRef>,
[src]pub fn from_component(
component: <R as UnorderedData<'a>>::ComponentsRef
) -> URef<'a, T, R>
[src]
component: <R as UnorderedData<'a>>::ComponentsRef
) -> URef<'a, T, R>
impl<'a, T, R> UnorderedData<'a> for URef<'a, T, R> where
T: OneToOneComponent<'a> + Component,
R: UnorderedData<'a>,
<T as Component>::Storage: for<'s> Storage<'s, T>,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
[src]
impl<'a, T, R> UnorderedData<'a> for URef<'a, T, R> where
T: OneToOneComponent<'a> + Component,
R: UnorderedData<'a>,
<T as Component>::Storage: for<'s> Storage<'s, T>,
<<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<T>,
[src]type Iter = RefIter<'a, <URef<'a, T, R> as UnorderedData<'a>>::Storage>
type IterMut = RefIter<'a, <URef<'a, T, R> as UnorderedData<'a>>::Storage>
type Components = <R as UnorderedData<'a>>::Components
type ComponentsRef = <R as UnorderedData<'a>>::ComponentsRef
type Storage = RefStorage<'a, ReadGuardRef<'a, <T as Component>::Storage>, T, <R as UnorderedData<'a>>::Storage, <R as UnorderedData<'a>>::Components, URefData, LazyIndexGuard<'a>>
pub fn query_mask<E>(entities: &E) -> Bitmask where
E: EntitiesStorage,
[src]
E: EntitiesStorage,
pub fn into_iter<E>(
entities: &'a E
) -> <URef<'a, T, R> as UnorderedData<'a>>::Iter where
E: EntitiesStorage,
[src]
entities: &'a E
) -> <URef<'a, T, R> as UnorderedData<'a>>::Iter where
E: EntitiesStorage,
pub fn into_iter_mut<E>(
entities: &'a E
) -> <URef<'a, T, R> as UnorderedData<'a>>::IterMut where
E: EntitiesStorage,
[src]
entities: &'a E
) -> <URef<'a, T, R> as UnorderedData<'a>>::IterMut where
E: EntitiesStorage,
pub fn storage<E>(
entities: &'a E
) -> Option<<URef<'a, T, R> as UnorderedData<'a>>::Storage> where
E: EntitiesStorage,
[src]
entities: &'a E
) -> Option<<URef<'a, T, R> as UnorderedData<'a>>::Storage> where
E: EntitiesStorage,
impl<'a, T, R> SafeIter<'a> for URef<'a, T, R> where
T: OneToOneComponent<'a>,
R: SafeIter<'a>,
[src]
T: OneToOneComponent<'a>,
R: SafeIter<'a>,
impl<'a, T, R> SafeStreamingIter<'a> for URef<'a, T, R> where
T: OneToOneComponent<'a>,
[src]
T: OneToOneComponent<'a>,
Auto Trait Implementations
impl<'a, T, R> RefUnwindSafe for URef<'a, T, R> where
R: RefUnwindSafe,
T: RefUnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, R> Send for URef<'a, T, R> where
R: Send,
T: Send,
R: Send,
T: Send,
impl<'a, T, R> Sync for URef<'a, T, R> where
R: Sync,
T: Sync,
R: Sync,
T: Sync,
impl<'a, T, R> Unpin for URef<'a, T, R> where
R: Unpin,
T: Unpin,
R: Unpin,
T: Unpin,
impl<'a, T, R> UnwindSafe for URef<'a, T, R> where
R: UnwindSafe,
T: UnwindSafe,
R: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<U, T> AsUniform<dyn Deref<Target = [[f32; 3]; 3]> + 'static> for U where
T: AsUniform<[[f32; 3]; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [[f32; 3]; 3]> + 'static> for U where
T: AsUniform<[[f32; 3]; 3]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [[f32; 4]; 4]> + 'static> for U where
T: AsUniform<[[f32; 4]; 4]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [[f32; 4]; 4]> + 'static> for U where
T: AsUniform<[[f32; 4]; 4]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 2]> + 'static> for U where
T: AsUniform<[f32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 2]> + 'static> for U where
T: AsUniform<[f32; 2]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 3]> + 'static> for U where
T: AsUniform<[f32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 3]> + 'static> for U where
T: AsUniform<[f32; 3]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [f32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 4]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 2]> + 'static> for U where
T: AsUniform<[i32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 2]> + 'static> for U where
T: AsUniform<[i32; 2]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 3]> + 'static> for U where
T: AsUniform<[i32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 3]> + 'static> for U where
T: AsUniform<[i32; 3]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [i32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 4]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 2]> + 'static> for U where
T: AsUniform<[u32; 2]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 2]> + 'static> for U where
T: AsUniform<[u32; 2]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 3]> + 'static> for U where
T: AsUniform<[u32; 3]>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 3]> + 'static> for U where
T: AsUniform<[u32; 3]>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = [u32; 4]> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 4]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[[f32; 3]; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[[f32; 3]; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[[f32; 3]; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[[f32; 3]; 3]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[[f32; 4]; 4]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[[f32; 4]; 4]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[[f32; 4]; 4]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[[f32; 4]; 4]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[f32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[f32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 2]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[f32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[f32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[f32; 3]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[i32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[i32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 2]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[i32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[i32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[i32; 3]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[u32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 2]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[u32; 2]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 2]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[u32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 3]> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<[u32; 3]> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<[u32; 3]> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<f32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<f32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<f32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<f32> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<i32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<i32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<i32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<i32> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<u32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<u32> + 'static>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = dyn AsRef<u32> + 'static> + 'static> for U where
T: AsUniform<dyn AsRef<u32> + 'static>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = i32> + 'static> for U where
T: AsUniform<i32>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = i32> + 'static> for U where
T: AsUniform<i32>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<U, T> AsUniform<dyn Deref<Target = u32> + 'static> for U where
T: AsUniform<u32>,
U: Deref<Target = T>,
[src]
impl<U, T> AsUniform<dyn Deref<Target = u32> + 'static> for U where
T: AsUniform<u32>,
U: Deref<Target = T>,
[src]pub fn as_uniform(&self) -> UniformValue
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]