pub struct Size {
pub x: u32,
pub y: u32,
pub z: u32,
}Expand description
3D size in blocks.
Used by Chunk.
Fields§
§x: u32§y: u32§z: u32Implementations§
Source§impl Size
impl Size
pub const fn new(x: u32, y: u32, z: u32) -> Self
Sourcepub fn contains(self, coordinate: impl Into<Coordinate>) -> bool
pub fn contains(self, coordinate: impl Into<Coordinate>) -> bool
Returns true if the offset Coordinate is within the size.
Sourcepub const fn index_to_offset(self, index: usize) -> Coordinate
pub const fn index_to_offset(self, index: usize) -> Coordinate
Convert a Chunk index to an offset Coordinate.
Sourcepub fn offset_to_index(self, coordinate: impl Into<Coordinate>) -> usize
pub fn offset_to_index(self, coordinate: impl Into<Coordinate>) -> usize
Convert an offset Coordinate to a Chunk index.
pub fn flat(self) -> Size2D
Trait Implementations§
impl Copy for Size
impl Eq for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
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