#[repr(C)]pub union Tile {
pub id: u16,
pub position: [u8; 2],
}Expand description
A union representing a tile in a tilemap.
The ID should always be stored using big endian. If it is not, X and Y will be swapped, which is undesirable. Be careful!
Fields§
§id: u16Identifier
position: [u8; 2]XY position
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn id_mut(&mut self) -> &mut u16
pub fn id_mut(&mut self) -> &mut u16
Safely returns a mutable reference to the tile’s ID.
Make sure any writes to this are big endian! Little endian won’t be unsound, but will swap X and Y when reading position.
Sourcepub fn position_mut(&mut self) -> &mut [u8; 2]
pub fn position_mut(&mut self) -> &mut [u8; 2]
Safely returns a mutable reference to the tile’s position.
Trait Implementations§
impl Copy for Tile
impl Pod for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.