Custom Loc debug formatter
This commit is contained in:
parent
8291a07ee4
commit
af682d88ff
|
@ -5,7 +5,7 @@ use crate::matrix::Mat;
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
|
|
||||||
/// Represents a location for a piece, including its orientation.
|
/// Represents a location for a piece, including its orientation.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)]
|
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct Loc {
|
pub struct Loc {
|
||||||
/// Horizontal coordinate.
|
/// Horizontal coordinate.
|
||||||
pub x: i16,
|
pub x: i16,
|
||||||
|
@ -29,6 +29,12 @@ impl From<(i16, i16)> for Loc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Debug for Loc {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
(self.x, self.y, self.r).fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Represents a rotation state for a piece. The initial state is "north" (`N`), and there
|
/// Represents a rotation state for a piece. The initial state is "north" (`N`), and there
|
||||||
/// are 4 total orientations to represent each 90 degree turn possible.
|
/// are 4 total orientations to represent each 90 degree turn possible.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Default, Hash)]
|
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Default, Hash)]
|
||||||
|
|
Loading…
Reference in New Issue