pub struct PoiTypeRegistry {
types_by_id: Vec<PoiTypeRef>,
types_by_key: FxHashMap<Identifier, usize>,
state_to_type: FxHashMap<BlockStateId, usize>,
tags: FxHashMap<Identifier, Vec<Identifier>>,
allows_registering: bool,
}Expand description
Registry of all POI types, with reverse lookup from block state to type.
Fields§
§types_by_id: Vec<PoiTypeRef>§types_by_key: FxHashMap<Identifier, usize>§state_to_type: FxHashMap<BlockStateId, usize>O(1) block state -> POI type ID lookup.
allows_registering: boolImplementations§
Source§impl PoiTypeRegistry
impl PoiTypeRegistry
pub fn new() -> Self
pub fn register(&mut self, poi_type: PoiTypeRef) -> usize
pub fn type_for_state(&self, state_id: BlockStateId) -> Option<PoiTypeRef>
pub fn type_id_for_state(&self, state_id: BlockStateId) -> Option<usize>
pub fn is_poi_state(&self, state_id: BlockStateId) -> bool
pub fn iter(&self) -> impl Iterator<Item = (usize, PoiTypeRef)> + '_
Trait Implementations§
Source§impl Default for PoiTypeRegistry
impl Default for PoiTypeRegistry
Source§impl RegistryExt for PoiTypeRegistry
impl RegistryExt for PoiTypeRegistry
type Entry = PointOfInterestType
fn freeze(&mut self)
fn by_id(&self, id: usize) -> Option<&'static PointOfInterestType>
fn by_key(&self, key: &Identifier) -> Option<&'static PointOfInterestType>
fn id_from_key(&self, key: &Identifier) -> Option<usize>
fn len(&self) -> usize
fn is_empty(&self) -> bool
Source§impl TaggedRegistryExt for PoiTypeRegistry
impl TaggedRegistryExt for PoiTypeRegistry
fn register_tag(&mut self, tag: Identifier, keys: &[&'static str])
fn modify_tag( &mut self, tag: &Identifier, f: impl FnOnce(Vec<Identifier>) -> Vec<Identifier>, )
fn is_in_tag(&self, entry: &Self::Entry, tag: &Identifier) -> bool
fn get_tag(&self, tag: &Identifier) -> Option<Vec<&'static Self::Entry>>
fn iter_tag( &self, tag: &Identifier, ) -> impl Iterator<Item = &'static Self::Entry> + '_
fn tag_keys(&self) -> impl Iterator<Item = &Identifier> + '_
Auto Trait Implementations§
impl Freeze for PoiTypeRegistry
impl RefUnwindSafe for PoiTypeRegistry
impl Send for PoiTypeRegistry
impl Sync for PoiTypeRegistry
impl Unpin for PoiTypeRegistry
impl UnsafeUnpin for PoiTypeRegistry
impl UnwindSafe for PoiTypeRegistry
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