use crate::bitset::Set;
use crate::board::{Block, Cell, Col, Digit, Row};
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[allow(missing_docs)]
pub struct Candidate {
pub cell: Cell,
pub digit: Digit,
}
impl Candidate {
#[inline]
pub fn new(cell: u8, digit: u8) -> Candidate {
assert!(cell < 81);
assert!(0 < digit && digit < 10);
Candidate {
cell: Cell::new(cell),
digit: Digit::new(digit),
}
}
#[inline]
pub fn row(self) -> Row {
self.cell.row()
}
#[inline]
pub fn col(self) -> Col {
self.cell.col()
}
#[inline]
pub fn block(self) -> Block {
self.cell.block()
}
#[inline]
pub(crate) fn digit_set(self) -> Set<Digit> {
self.digit.as_set()
}
}