pub struct ReverseIndex { /* private fields */ }Expand description
Reverse-reference index over a model snapshot.
Derived state: it reflects the model as it was when built. Mutating the
model afterwards does not update it, and the borrow checker enforces that
for the common &Model case.
Implementations§
Source§impl ReverseIndex
impl ReverseIndex
Sourcepub fn build(model: &Model) -> Self
pub fn build(model: &Model) -> Self
Scan every entity once and record each reference by target.
Sourcepub fn referrers(&self, target: EntityId) -> &[Referrer]
pub fn referrers(&self, target: EntityId) -> &[Referrer]
Every reference pointing at target, in ascending (from, slot) order.
Sourcepub fn referrers_in_slot(
&self,
target: EntityId,
slot: usize,
) -> impl Iterator<Item = EntityId> + '_
pub fn referrers_in_slot( &self, target: EntityId, slot: usize, ) -> impl Iterator<Item = EntityId> + '_
Entities referencing target from the given attribute slot.
This is the query objectified relationships need: “which relationship entities name me in their RelatingStructure slot”.
Sourcepub fn is_referenced(&self, target: EntityId) -> bool
pub fn is_referenced(&self, target: EntityId) -> bool
Whether anything references target.
Trait Implementations§
Source§impl Clone for ReverseIndex
impl Clone for ReverseIndex
Source§impl Debug for ReverseIndex
impl Debug for ReverseIndex
Auto Trait Implementations§
impl Freeze for ReverseIndex
impl RefUnwindSafe for ReverseIndex
impl Send for ReverseIndex
impl Sync for ReverseIndex
impl Unpin for ReverseIndex
impl UnsafeUnpin for ReverseIndex
impl UnwindSafe for ReverseIndex
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