1use clap::{Parser, ValueEnum};
5
6#[derive(Debug, Parser, Clone, Default)]
7pub struct WasmFeatures {
10 #[clap(long = "enable-simd")]
12 pub simd: bool,
13
14 #[clap(long = "disable-threads")]
16 pub disable_threads: bool,
17
18 #[clap(long = "enable-threads")]
20 pub _threads: bool,
21
22 #[clap(long = "enable-reference-types")]
24 pub reference_types: bool,
25
26 #[clap(long = "enable-multi-value")]
28 pub multi_value: bool,
29
30 #[clap(long = "enable-bulk-memory")]
32 pub bulk_memory: bool,
33
34 #[clap(long = "enable-all")]
36 pub all: bool,
37}
38
39pub(crate) fn normalize_path(s: &str) -> String {
40 s.strip_prefix(r"\\?\").unwrap_or(s).to_string()
41}
42
43#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
45pub enum HashAlgorithm {
46 Sha256,
48 XXHash,
50}
51
52impl Default for HashAlgorithm {
53 fn default() -> Self {
54 Self::Sha256
55 }
56}
57
58impl From<HashAlgorithm> for wasmer_types::HashAlgorithm {
59 fn from(value: HashAlgorithm) -> Self {
60 match value {
61 HashAlgorithm::Sha256 => wasmer_types::HashAlgorithm::Sha256,
62 HashAlgorithm::XXHash => wasmer_types::HashAlgorithm::XXHash,
63 }
64 }
65}