wasi_test_generator/
wasi_version.rs

1pub static ALL_WASI_VERSIONS: &[WasiVersion] = &[WasiVersion::Unstable, WasiVersion::Snapshot1];
2pub static LATEST_WASI_VERSION: &[WasiVersion] = &[WasiVersion::get_latest()];
3pub static NIGHTLY_VERSION: &[WasiVersion] = &[WasiVersion::current_nightly()];
4
5#[derive(Debug, Clone, Copy)]
6pub enum WasiVersion {
7    /// A.K.A. Snapshot0
8    Unstable,
9    Snapshot1,
10    /// This is for making tests pass on Apple M1 while
11    /// still keeping the old test for compatibility reasons
12    #[allow(non_camel_case_types)]
13    Nightly_2022_10_18,
14}
15
16impl WasiVersion {
17    pub const fn get_latest() -> Self {
18        Self::Snapshot1
19    }
20
21    pub const fn current_nightly() -> Self {
22        Self::Nightly_2022_10_18
23    }
24
25    pub fn get_compiler_toolchain(&self) -> &'static str {
26        match self {
27            WasiVersion::Unstable => "nightly-2019-09-13",
28            WasiVersion::Snapshot1 => "1.53.0",
29            WasiVersion::Nightly_2022_10_18 => "nightly-2022-10-18",
30        }
31    }
32
33    pub fn get_directory_name(&self) -> &'static str {
34        match self {
35            WasiVersion::Unstable => "unstable",
36            WasiVersion::Snapshot1 => "snapshot1",
37            WasiVersion::Nightly_2022_10_18 => "nightly_2022_10_18",
38        }
39    }
40}