Skip to main content

ColumnMap

Struct ColumnMap 

Source
pub struct ColumnMap<C = Column> { /* private fields */ }
Expand description

The loaded columns. Version-independent; the version worlds wrap it. C is the column type (the legacy Column by default; the modern worlds use their own).

Implementations§

Source§

impl<C> ColumnMap<C>

Source

pub fn get(&self, cx: i32, cz: i32) -> Option<&C>

The column at (cx, cz) if loaded.

Source

pub fn get_mut(&mut self, cx: i32, cz: i32) -> Option<&mut C>

Mutable access to a loaded column.

Source

pub fn contains(&self, cx: i32, cz: i32) -> bool

true when the column has been received and not unloaded.

Source

pub fn insert(&mut self, cx: i32, cz: i32, column: C)

Inserts (replaces) a column.

Source

pub fn remove(&mut self, cx: i32, cz: i32) -> bool

Removes a column; true if it was loaded.

Source

pub fn clear(&mut self)

Unloads everything.

Source

pub fn retain(&mut self, keep: impl FnMut(ChunkPos) -> bool)

Keeps only the columns for which keep returns true.

Source

pub fn len(&self) -> usize

Number of loaded columns.

Source

pub fn is_empty(&self) -> bool

true when no column is loaded.

Source

pub fn iter(&self) -> impl Iterator<Item = (ChunkPos, &C)>

Iterates the loaded columns (arbitrary order).

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (ChunkPos, &mut C)>

Iterates the loaded columns mutably (arbitrary order).

Source

pub fn table_bytes(&self) -> usize

Heap bytes of the hash table itself (entries included, column contents excluded).

Source§

impl ColumnMap<Column>

Source

pub fn raw(&self, x: i32, y: i32, z: i32) -> Option<u16>

Raw state at a block position; None when the column is not loaded.

Source

pub fn heap_bytes(&self) -> usize

Approximate heap bytes: columns plus the hash table.

Trait Implementations§

Source§

impl<C: Clone> Clone for ColumnMap<C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug> Debug for ColumnMap<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C> Default for ColumnMap<C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C> Forget for ColumnMap<C>

§

impl<C> Freeze for ColumnMap<C>
where PhantomData<fn() -> ChunkHasher>: Freeze, *const u8 is !null: Freeze, PhantomData<(u64, C)>: Freeze,

§

impl<C> Move for ColumnMap<C>

§

impl<C> RefUnwindSafe for ColumnMap<C>
where C: RefUnwindSafe,

§

impl<C> Send for ColumnMap<C>
where RawTable<(u64, C)>: Send,

§

impl<C> Sync for ColumnMap<C>
where RawTable<(u64, C)>: Sync,

§

impl<C> Unpin for ColumnMap<C>
where C: Unpin, *const u8 is !null: Unpin,

§

impl<C> UnsafeUnpin for ColumnMap<C>
where PhantomData<fn() -> ChunkHasher>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(u64, C)>: UnsafeUnpin,

§

impl<C> UnwindSafe for ColumnMap<C>
where HashMap<u64, C, BuildHasherDefault<ChunkHasher>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.