Started working on optimizer
This commit is contained in:
@@ -13,7 +13,7 @@ pub(crate) struct IconBitfield {
|
||||
}
|
||||
|
||||
impl IconBitfield {
|
||||
pub(crate) fn get_icon_bits(&self, icon: Icon) -> u8 {
|
||||
pub fn get_icon_bits(&self, icon: Icon) -> u8 {
|
||||
match icon {
|
||||
Icon::Circle => self.circle,
|
||||
Icon::Square => self.square,
|
||||
@@ -21,11 +21,11 @@ impl IconBitfield {
|
||||
Icon::Color => self.color,
|
||||
}
|
||||
}
|
||||
pub(crate) fn get_point_bits(&self) -> u8 {
|
||||
pub fn get_point_bits(&self) -> u8 {
|
||||
self.points
|
||||
}
|
||||
|
||||
pub(crate) fn add_icon(&mut self, icon: Icon, index: u8) {
|
||||
fn add_icon(&mut self, icon: Icon, index: u8) {
|
||||
let field = match icon {
|
||||
Icon::Circle => &mut self.circle,
|
||||
Icon::Square => &mut self.square,
|
||||
@@ -46,11 +46,12 @@ impl IconBitfield {
|
||||
CardField::Empty => (),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(card: &Card) -> Self {
|
||||
let mut result = Self::default();
|
||||
(0u8..)
|
||||
.zip(card.field.iter())
|
||||
.for_each(|(index, field)| result.add_field(field.clone(), index));
|
||||
.for_each(|(index, field)| result.add_field(*field, index));
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user