-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use bitflags::bitflags; | ||
|
||
bitflags! { | ||
pub struct Dirs: u8 { | ||
const NORTH = 1 << 1; | ||
const SOUTH = 1 << 2; | ||
const EAST = 1 << 3; | ||
const WEST = 1 << 4; | ||
const SOUTHEAST = Self::SOUTH.bits() | Self::EAST.bits(); | ||
const SOUTHWEST = Self::SOUTH.bits() | Self::WEST.bits(); | ||
const NORTHEAST = Self::NORTH.bits() | Self::EAST.bits(); | ||
const NORTHWEST = Self::NORTH.bits() | Self::WEST.bits(); | ||
} | ||
} | ||
|
||
/// A list of every cardinal direction. | ||
pub const CARDINAL_DIRS: [Dirs; 4] = [Dirs::NORTH, Dirs::SOUTH, Dirs::EAST, Dirs::WEST]; | ||
|
||
/// A list of every ordinal direction. | ||
pub const ORDINAL_DIRS: [Dirs; 4] = [ | ||
Dirs::NORTHEAST, | ||
Dirs::NORTHWEST, | ||
Dirs::SOUTHEAST, | ||
Dirs::SOUTHWEST, | ||
]; | ||
|
||
/// A list of every direction, cardinals and ordinals. | ||
pub const ALL_DIRS: [Dirs; 8] = [ | ||
Dirs::NORTH, | ||
Dirs::SOUTH, | ||
Dirs::EAST, | ||
Dirs::WEST, | ||
Dirs::NORTHEAST, | ||
Dirs::NORTHWEST, | ||
Dirs::SOUTHEAST, | ||
Dirs::SOUTHWEST, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod chunk; | ||
pub(crate) mod crc; | ||
pub mod dirs; | ||
pub mod error; | ||
pub mod icon; | ||
pub mod iend; | ||
|