#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Verbosity {
Quiet = 0,
Normal = 1,
Verbose = 2,
Debug = 3,
}
impl Default for Verbosity {
fn default() -> Self {
Self::Normal
}
}
impl Verbosity {
pub fn from_flags(verbose: bool, debug: bool) -> Self {
if debug {
Self::Debug
} else if verbose {
Self::Verbose
} else {
Self::Normal
}
}
pub fn is_debug(&self) -> bool {
*self >= Self::Debug
}
pub fn is_verbose(&self) -> bool {
*self >= Self::Verbose
}
pub fn is_normal(&self) -> bool {
*self >= Self::Normal
}
}
#[derive(Debug, Clone)]
pub struct CompilerOptions {
pub optimize: bool,
pub debug_info: bool,
pub max_memory: u32,
pub entry_point: Option<String>,
pub generate_html: bool,
pub include_metadata: bool,
pub verbosity: Verbosity,
}
impl Default for CompilerOptions {
fn default() -> Self {
Self {
optimize: true,
debug_info: false,
max_memory: 2, entry_point: None,
generate_html: false,
include_metadata: false,
verbosity: Verbosity::default(),
}
}
}