summaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-07-08 22:31:41 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-07-08 22:31:41 +0200
commit770f14609849552d965b4e9101bfb5c0870c08d0 (patch)
tree170ebb08b86ccc5027752f37bf0dda4be516a2b7 /src/geometry
parent2d4647a618234ef496899d875f75d57b5af1a6e5 (diff)
Command filtering to avoid wasting the selects
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/direction.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/geometry/direction.rs b/src/geometry/direction.rs
index 737bd00..d3f3b20 100644
--- a/src/geometry/direction.rs
+++ b/src/geometry/direction.rs
@@ -1,5 +1,5 @@
-use std::fmt;
use crate::geometry::vec::Vec2d;
+use std::fmt;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Direction {
@@ -54,17 +54,14 @@ impl Direction {
}
}
- pub fn all() -> [Direction; 8] {
- use Direction::*;
- [
- North,
- NorthEast,
- East,
- SouthEast,
- South,
- SouthWest,
- West,
- NorthWest,
- ]
- }
+ pub const ALL: [Direction; 8] = [
+ Direction::North,
+ Direction::NorthEast,
+ Direction::East,
+ Direction::SouthEast,
+ Direction::South,
+ Direction::SouthWest,
+ Direction::West,
+ Direction::NorthWest,
+ ];
}