pub struct TileSet32<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize>(/* private fields */);Expand description
A grid A map from tiles to bools. Can store up to 256 tiles.
Implementations§
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> TileSet32<WIDTH, HEIGHT, SIZE>
pub fn from_fn<F: FnMut(Tile<WIDTH, HEIGHT>) -> bool>(cb: F) -> Self
pub const fn from_inner(inner: u32) -> Self
pub const fn into_inner(self) -> u32
pub const fn is_empty(self) -> bool
pub const fn set_bit(&mut self, tile: &Tile<WIDTH, HEIGHT>, bit: bool)
pub const fn insert(&mut self, tile: &Tile<WIDTH, HEIGHT>) -> bool
pub const fn remove(&mut self, tile: &Tile<WIDTH, HEIGHT>) -> bool
Sourcepub const fn with_bit_set(&self, tile: &Tile<WIDTH, HEIGHT>, bit: bool) -> Self
pub const fn with_bit_set(&self, tile: &Tile<WIDTH, HEIGHT>, bit: bool) -> Self
Returns a copy of self with the bit at tile set to bit
pub const fn get_bit(&self, tile: &Tile<WIDTH, HEIGHT>) -> bool
pub const fn iter( &self, ) -> impl DoubleEndedIterator<Item = bool> + ExactSizeIterator
pub const fn row( &self, y: u8, ) -> impl DoubleEndedIterator<Item = bool> + ExactSizeIterator
pub const fn col( &self, x: u8, ) -> impl DoubleEndedIterator<Item = bool> + ExactSizeIterator
pub const fn shift_north(&self, rows: u8) -> Self
pub const fn shift_south(&self, rows: u8) -> Self
pub const fn shift_east(&self) -> Self
pub const fn shift_west(&self) -> Self
pub const fn row_mask(y: u8) -> Self
pub const fn col_mask(x: u8) -> Self
pub fn enumerate( &self, ) -> impl DoubleEndedIterator<Item = (Tile<WIDTH, HEIGHT>, bool)> + ExactSizeIterator
pub const fn iter_true_tiles( &self, ) -> impl ExactSizeIterator<Item = Tile<WIDTH, HEIGHT>> + Clone + Debug + FusedIterator + DoubleEndedIterator
pub const fn count(&self) -> u32
Sourcepub const fn get_scale(total_width: f32, total_height: f32) -> f32
pub const fn get_scale(total_width: f32, total_height: f32) -> f32
Get the scale to make the grid take up as much as possible of a given area
pub const fn intersect(&self, rhs: &Self) -> Self
pub const fn union(&self, rhs: &Self) -> Self
pub const fn except(&self, rhs: &Self) -> Self
pub const fn is_subset(&self, rhs: &Self) -> bool
pub const fn is_superset(&self, rhs: &Self) -> bool
Sourcepub const fn symmetric_difference(&self, rhs: &Self) -> Self
pub const fn symmetric_difference(&self, rhs: &Self) -> Self
Returns a new set containing all elements which belong to one set but not both
pub const fn negate(&self) -> Self
Sourcepub const fn pop(&mut self) -> Option<Tile<WIDTH, HEIGHT>>
pub const fn pop(&mut self) -> Option<Tile<WIDTH, HEIGHT>>
Removes the first tile in this set and returns it
Returns None if the set is empty
Sourcepub const fn pop_last(&mut self) -> Option<Tile<WIDTH, HEIGHT>>
pub const fn pop_last(&mut self) -> Option<Tile<WIDTH, HEIGHT>>
Removes the first tile in this set and returns it
Returns None if the set is empty
Sourcepub const fn tiles_before(&self, tile: Tile<WIDTH, HEIGHT>) -> u32
pub const fn tiles_before(&self, tile: Tile<WIDTH, HEIGHT>) -> u32
Returns the number of tiles in the set which are less than this tile. Note that it returns the same result whether or not the given tile is in the set
Trait Implementations§
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Clone for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Clone for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Debug for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Debug for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Default for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Default for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<'de, const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Deserialize<'de> for TileSet32<WIDTH, HEIGHT, SIZE>
impl<'de, const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Deserialize<'de> for TileSet32<WIDTH, HEIGHT, SIZE>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> FromIterator<Tile<WIDTH, HEIGHT>> for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> FromIterator<Tile<WIDTH, HEIGHT>> for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Hash for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Hash for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Ord for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Ord for TileSet32<WIDTH, HEIGHT, SIZE>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> PartialEq for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> PartialEq for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> PartialOrd for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> PartialOrd for TileSet32<WIDTH, HEIGHT, SIZE>
Source§impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Serialize for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Serialize for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Copy for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Eq for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> StructuralPartialEq for TileSet32<WIDTH, HEIGHT, SIZE>
Auto Trait Implementations§
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Freeze for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> RefUnwindSafe for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Send for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Sync for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> Unpin for TileSet32<WIDTH, HEIGHT, SIZE>
impl<const WIDTH: u8, const HEIGHT: u8, const SIZE: usize> UnwindSafe for TileSet32<WIDTH, HEIGHT, 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 more