impl Debug for Cells
This commit is contained in:
parent
583b6b64f8
commit
1dcf36ef6f
|
@ -154,6 +154,27 @@ impl<'c> Cells<'c> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Debug for Cells<'_> {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
let data = self.data();
|
||||||
|
let (xs, ys) = self.extents();
|
||||||
|
write!(f, "Cells{{x0={},y0={},data=[", xs.start, ys.start)?;
|
||||||
|
for (i, &row) in data.iter().enumerate() {
|
||||||
|
if i > 0 {
|
||||||
|
write!(f, ",")?;
|
||||||
|
}
|
||||||
|
write!(f, "\"")?;
|
||||||
|
for j in 0..xs.len() {
|
||||||
|
let occ = row & (1 << j) != 0;
|
||||||
|
write!(f, "{}", if occ { 'x' } else { '.' })?;
|
||||||
|
}
|
||||||
|
write!(f, "\"")?;
|
||||||
|
}
|
||||||
|
write!(f, "]}}")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Represents the current state of a piece.
|
/// Represents the current state of a piece.
|
||||||
#[derive(Clone, Eq, PartialEq, Debug)]
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
||||||
pub struct Piece<S> {
|
pub struct Piece<S> {
|
||||||
|
|
Loading…
Reference in New Issue