use clap::{Parser, ValueEnum};
#[derive(Debug, Parser, Clone, Default)]
pub struct WasmFeatures {
#[clap(long = "enable-simd")]
pub simd: bool,
#[clap(long = "disable-threads")]
pub disable_threads: bool,
#[clap(long = "enable-threads")]
pub _threads: bool,
#[clap(long = "enable-reference-types")]
pub reference_types: bool,
#[clap(long = "enable-multi-value")]
pub multi_value: bool,
#[clap(long = "enable-bulk-memory")]
pub bulk_memory: bool,
#[clap(long = "enable-all")]
pub all: bool,
}
pub(crate) fn normalize_path(s: &str) -> String {
s.strip_prefix(r"\\?\").unwrap_or(s).to_string()
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum HashAlgorithm {
Sha256,
XXHash,
}
impl Default for HashAlgorithm {
fn default() -> Self {
Self::Sha256
}
}
impl From<HashAlgorithm> for wasmer_types::HashAlgorithm {
fn from(value: HashAlgorithm) -> Self {
match value {
HashAlgorithm::Sha256 => wasmer_types::HashAlgorithm::Sha256,
HashAlgorithm::XXHash => wasmer_types::HashAlgorithm::XXHash,
}
}
}