2023-07-24 01:32:11 +00:00
|
|
|
use crate::matrix::{MatrixCell, ScoreCell};
|
2023-07-20 22:16:15 +00:00
|
|
|
use std::fmt::{Debug, Formatter, Result};
|
|
|
|
|
2023-07-24 01:32:11 +00:00
|
|
|
// impl<C: Char> MatcherData<'_, C> {
|
|
|
|
// pub fn rows(&self) -> impl Iterator<Item = MatrixRow> + ExactSizeIterator + Clone + Sized {
|
|
|
|
// let mut cells = &*self.cells;
|
|
|
|
// self.row_offs.iter().map(move |&off| {
|
|
|
|
// let len = self.haystack.len() - off as usize;
|
|
|
|
// let (row, tmp) = cells.split_at(len);
|
|
|
|
// cells = tmp;
|
|
|
|
// MatrixRow { off, cells: row }
|
|
|
|
// })
|
|
|
|
// }
|
2023-07-20 22:16:15 +00:00
|
|
|
|
2023-07-24 01:32:11 +00:00
|
|
|
// pub fn haystack(
|
|
|
|
// &self,
|
|
|
|
// ) -> impl Iterator<Item = HaystackChar<C>> + ExactSizeIterator + '_ + Clone {
|
|
|
|
// haystack(self.haystack, self.bonus, 0)
|
|
|
|
// }
|
|
|
|
// }
|
2023-07-20 22:16:15 +00:00
|
|
|
|
2023-07-24 01:32:11 +00:00
|
|
|
impl Debug for ScoreCell {
|
2023-07-20 22:16:15 +00:00
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
2023-07-26 13:32:04 +00:00
|
|
|
write!(f, "({}, {})", self.score, self.matched)
|
2023-07-20 22:16:15 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-24 01:32:11 +00:00
|
|
|
|
|
|
|
impl Debug for MatrixCell {
|
2023-07-20 22:16:15 +00:00
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
2023-07-24 01:32:11 +00:00
|
|
|
write!(f, "({}, {})", (self.0 & 1) != 0, (self.0 & 2) != 0)
|
2023-07-20 22:16:15 +00:00
|
|
|
}
|
|
|
|
}
|