#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CanisterBuildProfile {
Debug,
Fast,
Release,
}
impl CanisterBuildProfile {
#[must_use]
pub fn current() -> Self {
match std::env::var("CANIC_WASM_PROFILE").ok().as_deref() {
Some("debug") => Self::Debug,
Some("fast") => Self::Fast,
_ => Self::Release,
}
}
#[must_use]
pub const fn cargo_args(self) -> &'static [&'static str] {
match self {
Self::Debug => &[],
Self::Fast => &["--profile", "fast"],
Self::Release => &["--release"],
}
}
#[must_use]
pub const fn target_dir_name(self) -> &'static str {
match self {
Self::Debug => "debug",
Self::Fast => "fast",
Self::Release => "release",
}
}
}