pub struct PointOfInterestSet {
pois_by_pos: FxHashMap<PackedSectionBlockPos, PointOfInterest>,
pois_by_type: FxHashMap<usize, FxHashSet<PackedSectionBlockPos>>,
dirty: bool,
}Expand description
Stores all POIs within a single chunk section (16x16x16).
Uses a section-relative packed block position as the key, with a secondary index by POI type for type-filtered queries.
Fields§
§pois_by_pos: FxHashMap<PackedSectionBlockPos, PointOfInterest>§pois_by_type: FxHashMap<usize, FxHashSet<PackedSectionBlockPos>>§dirty: boolImplementations§
Source§impl PointOfInterestSet
impl PointOfInterestSet
Sourcepub fn add(
&mut self,
packed_pos: PackedSectionBlockPos,
poi: PointOfInterest,
) -> Option<&PointOfInterest>
pub fn add( &mut self, packed_pos: PackedSectionBlockPos, poi: PointOfInterest, ) -> Option<&PointOfInterest>
Returns a reference to the inserted POI, or None if one already exists at that position.
Sourcepub fn remove(
&mut self,
packed_pos: PackedSectionBlockPos,
) -> Option<PointOfInterest>
pub fn remove( &mut self, packed_pos: PackedSectionBlockPos, ) -> Option<PointOfInterest>
Removes and returns the POI at the given packed position, if present.
Sourcepub fn get(&self, packed_pos: PackedSectionBlockPos) -> Option<&PointOfInterest>
pub fn get(&self, packed_pos: PackedSectionBlockPos) -> Option<&PointOfInterest>
Returns a reference to the POI at the given packed position.
Sourcepub fn get_mut(
&mut self,
packed_pos: PackedSectionBlockPos,
) -> Option<&mut PointOfInterest>
pub fn get_mut( &mut self, packed_pos: PackedSectionBlockPos, ) -> Option<&mut PointOfInterest>
Returns a mutable reference to the POI at the given packed position.
Sourcepub fn get_by_type(
&self,
type_id: usize,
status: OccupationStatus,
max_tickets: u32,
) -> Vec<&PointOfInterest>
pub fn get_by_type( &self, type_id: usize, status: OccupationStatus, max_tickets: u32, ) -> Vec<&PointOfInterest>
Returns all POIs of the given type matching the occupation status.
Sourcepub fn get_matching(
&self,
type_predicate: &impl Fn(usize) -> bool,
status: OccupationStatus,
max_tickets_fn: &impl Fn(usize) -> u32,
) -> Vec<&PointOfInterest>
pub fn get_matching( &self, type_predicate: &impl Fn(usize) -> bool, status: OccupationStatus, max_tickets_fn: &impl Fn(usize) -> u32, ) -> Vec<&PointOfInterest>
Returns all POIs matching the type predicate and occupation status.
Sourcepub const fn is_dirty(&self) -> bool
pub const fn is_dirty(&self) -> bool
Returns true if any POIs have been added or removed since last cleared.
Sourcepub const fn clear_dirty(&mut self)
pub const fn clear_dirty(&mut self)
Clears the dirty flag.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (PackedSectionBlockPos, &PointOfInterest)>
pub fn iter( &self, ) -> impl Iterator<Item = (PackedSectionBlockPos, &PointOfInterest)>
Iterates over all POIs in this set as (packed_pos, poi) pairs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PointOfInterestSet
impl RefUnwindSafe for PointOfInterestSet
impl Send for PointOfInterestSet
impl Sync for PointOfInterestSet
impl Unpin for PointOfInterestSet
impl UnsafeUnpin for PointOfInterestSet
impl UnwindSafe for PointOfInterestSet
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreWraps this value in an
Arc<SyncMutex<>>