pub struct RegionHeader {
pub entries: Box<[ChunkEntry; 1024]>,
}Expand description
Region header containing chunk location table.
Fields§
§entries: Box<[ChunkEntry; 1024]>Chunk entries (1024 = 32×32).
Implementations§
Source§impl RegionHeader
impl RegionHeader
Sourcepub const fn chunk_index(local_x: usize, local_z: usize) -> usize
pub const fn chunk_index(local_x: usize, local_z: usize) -> usize
Gets the local index for a chunk position within this region.
Sourcepub const fn index_to_local(index: usize) -> (usize, usize)
pub const fn index_to_local(index: usize) -> (usize, usize)
Converts a chunk index back to local coordinates.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, usize>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, usize>
Sourcepub fn find_free_sectors(&self, sectors_needed: u32, file_sectors: u32) -> u32
pub fn find_free_sectors(&self, sectors_needed: u32, file_sectors: u32) -> u32
Finds a contiguous range of free sectors for allocation.
Returns the starting sector offset, or None if no suitable range exists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RegionHeader
impl RefUnwindSafe for RegionHeader
impl Send for RegionHeader
impl Sync for RegionHeader
impl Unpin for RegionHeader
impl UnsafeUnpin for RegionHeader
impl UnwindSafe for RegionHeader
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<>>