pub struct SubLayer { /* private fields */ }Expand description
A sublayer within a layer of a tilemap.
Implementations§
Source§impl SubLayer
impl SubLayer
Sourcepub fn set_default(&mut self, default: &[u8])
pub fn set_default(&mut self, default: &[u8])
Set the default value of the sublayer, resizing all cells to its length.
The default value is truncated to 4 bytes if larger.
If the new default value is larger than the old one, all cells are zero padded to the new length.
If the new default is smaller, all cells are truncated to its length.
This will only not reallocate if the length of the new default is the same as the old one!
Sourcepub fn get(&self, (x, y): (u32, u32)) -> Option<&[u8]>
pub fn get(&self, (x, y): (u32, u32)) -> Option<&[u8]>
Get a cell by position. Returns None if out of bounds.
Sourcepub fn get_mut(&mut self, (x, y): (u32, u32)) -> Option<&mut [u8]>
pub fn get_mut(&mut self, (x, y): (u32, u32)) -> Option<&mut [u8]>
Get a cell by position, mutably. Returns None if out of bounds
Trait Implementations§
impl Eq for SubLayer
impl StructuralPartialEq for SubLayer
Auto Trait Implementations§
impl Freeze for SubLayer
impl RefUnwindSafe for SubLayer
impl Send for SubLayer
impl Sync for SubLayer
impl Unpin for SubLayer
impl UnwindSafe for SubLayer
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