pub struct PlayerChunkView {
pub center: ChunkPos,
pub view_distance: u8,
}Expand description
A view of chunks around a center chunk.
Fields§
§center: ChunkPosThe center of the view.
view_distance: u8The view distance in chunks.
Implementations§
Source§impl PlayerChunkView
impl PlayerChunkView
Sourcepub const fn new(center: ChunkPos, view_distance: u8) -> Self
pub const fn new(center: ChunkPos, view_distance: u8) -> Self
Creates a new ChunkTrackingView with the given center and view distance.
fn min_x(&self) -> i32
fn max_x(&self) -> i32
fn min_z(&self) -> i32
fn max_z(&self) -> i32
Sourcepub fn contains(&self, pos: ChunkPos) -> bool
pub fn contains(&self, pos: ChunkPos) -> bool
Checks if the given chunk position is within the view.
Sourcepub fn is_within_distance(
center_x: i32,
center_z: i32,
view_distance: i32,
chunk_x: i32,
chunk_z: i32,
include_neighbors: bool,
) -> bool
pub fn is_within_distance( center_x: i32, center_z: i32, view_distance: i32, chunk_x: i32, chunk_z: i32, include_neighbors: bool, ) -> bool
Checks if a chunk at (chunk_x, chunk_z) is within the view distance of (center_x, center_z).
fn square_intersects(&self, other: &Self) -> bool
Sourcepub fn difference<T>(
old: &Self,
new: &Self,
on_added: impl FnMut(ChunkPos, &mut T),
on_removed: impl FnMut(ChunkPos, &mut T),
data: &mut T,
)
pub fn difference<T>( old: &Self, new: &Self, on_added: impl FnMut(ChunkPos, &mut T), on_removed: impl FnMut(ChunkPos, &mut T), data: &mut T, )
Calculates the difference between two views, calling on_added for chunks in the new view but not the old,
and on_removed for chunks in the old view but not the new.
Trait Implementations§
Source§impl Clone for PlayerChunkView
impl Clone for PlayerChunkView
Source§fn clone(&self) -> PlayerChunkView
fn clone(&self) -> PlayerChunkView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PlayerChunkView
Source§impl Debug for PlayerChunkView
impl Debug for PlayerChunkView
impl Eq for PlayerChunkView
Source§impl PartialEq for PlayerChunkView
impl PartialEq for PlayerChunkView
impl StructuralPartialEq for PlayerChunkView
Auto Trait Implementations§
impl Freeze for PlayerChunkView
impl RefUnwindSafe for PlayerChunkView
impl Send for PlayerChunkView
impl Sync for PlayerChunkView
impl Unpin for PlayerChunkView
impl UnsafeUnpin for PlayerChunkView
impl UnwindSafe for PlayerChunkView
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§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<>>