#![forbid(unsafe_code)]
use crate::dsfb::features::Channel;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct OptimizeOptions {
pub allow_dedup: bool,
pub allow_configurational: bool,
pub allow_rans: bool,
pub allow_bases: bool,
pub allow_universe: bool,
pub allow_dsfb_ranking: bool,
}
impl Default for OptimizeOptions {
fn default() -> Self {
Self {
allow_dedup: true,
allow_configurational: true,
allow_rans: true,
allow_bases: true,
allow_universe: true,
allow_dsfb_ranking: true,
}
}
}
impl OptimizeOptions {
pub const fn raw_only() -> Self {
Self {
allow_dedup: false,
allow_configurational: false,
allow_rans: false,
allow_bases: false,
allow_universe: false,
allow_dsfb_ranking: false,
}
}
pub const fn raw_rans() -> Self {
Self {
allow_dedup: false,
allow_configurational: false,
allow_rans: true,
allow_bases: false,
allow_universe: false,
allow_dsfb_ranking: false,
}
}
pub const fn channel_allowed(&self, channel: Channel) -> bool {
match channel {
Channel::SharedContent => self.allow_dedup,
Channel::PrevVersion
| Channel::Adjacent
| Channel::PrevInFile
| Channel::FamilyBase => self.allow_bases,
Channel::Universe => self.allow_universe,
Channel::Rans => self.allow_rans,
Channel::Raw => true,
}
}
}