pub struct R1NStore<T, U>{
pub parents: XvcStore<T>,
pub children: XvcStore<U>,
pub child_parents: XvcStore<ChildEntity<U, T>>,
}
Expand description
RNStore is 1-N RelationStore, where we store one-to-many relationships between two entities. It doesn’t have any semantics except binding two entities together.
Fields§
§parents: XvcStore<T>
Keeps the parent type
children: XvcStore<U>
Keeps the child type
child_parents: XvcStore<ChildEntity<U, T>>
Keeps the relationships between child entities and parent entities The key for the child_parents is the child entity, as there are many children for a parent.
Implementations§
Source§impl<T, U> R1NStore<T, U>
impl<T, U> R1NStore<T, U>
Sourcepub fn insert(
&mut self,
parent_entity: XvcEntity,
parent_component: T,
child_entity: XvcEntity,
child_component: U,
) -> Option<XvcEntity>
pub fn insert( &mut self, parent_entity: XvcEntity, parent_component: T, child_entity: XvcEntity, child_component: U, ) -> Option<XvcEntity>
Insert a child component to a parent parent_component. It checks whether the parent is equal to the given, and updates if there is a change.
Sourcepub fn children_of(&self, parent_entity: &XvcEntity) -> Result<HStore<U>, Error>
pub fn children_of(&self, parent_entity: &XvcEntity) -> Result<HStore<U>, Error>
get the store of related entities.
Trait Implementations§
Auto Trait Implementations§
impl<T, U> Freeze for R1NStore<T, U>
impl<T, U> RefUnwindSafe for R1NStore<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for R1NStore<T, U>
impl<T, U> Sync for R1NStore<T, U>
impl<T, U> Unpin for R1NStore<T, U>
impl<T, U> UnwindSafe for R1NStore<T, U>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more