wasm_opt/
features.rs

1use strum_macros::EnumString;
2
3/// Optional wasm features.
4///
5/// The [`Feature::Mvp`] feature represents the original spec.
6/// Other features are post-MVP,
7/// some specified and implemented in all engines,
8/// some specified but not implemented, some experimental.
9///
10/// See [the WebAssembly roadmap][rm] for an indication of which features can be
11/// used where.
12///
13/// [rm]: https://webassembly.org/roadmap/
14#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, EnumString)]
15pub enum Feature {
16    /// None.
17    #[strum(disabled)]
18    None,
19    /// Atomics.
20    ///
21    /// [Specification](https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md).
22    #[strum(serialize = "threads")]
23    Atomics,
24    /// Import and export of mutable globals.
25    ///
26    /// [Specification](https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md).
27    #[strum(serialize = "mutable-globals")]
28    MutableGlobals,
29    #[strum(serialize = "nontrapping-float-to-int")]
30    TruncSat,
31    /// Fixed-width SIMD.
32    ///
33    /// [Specification](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md).
34    #[strum(serialize = "simd")]
35    Simd,
36    /// Bulk memory operations.
37    ///
38    /// [Specification](https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md).
39    #[strum(serialize = "bulk-memory")]
40    BulkMemory,
41    /// Sign extension operations.
42    ///
43    /// [Specification](https://github.com/WebAssembly/spec/blob/master/proposals/sign-extension-ops/Overview.md).
44    #[strum(serialize = "sign-ext")]
45    SignExt,
46    /// Exception handling.
47    ///
48    /// [Specification](https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md).
49    #[strum(serialize = "exception-handling")]
50    ExceptionHandling,
51    /// Tail calls.
52    ///
53    /// [Specification](https://github.com/WebAssembly/tail-call/blob/master/proposals/tail-call/Overview.md).
54    #[strum(serialize = "tail-call")]
55    TailCall,
56    /// Reference types.
57    ///
58    /// [Specification](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md).
59    #[strum(serialize = "reference-types")]
60    ReferenceTypes,
61    /// Multi-value.
62    ///
63    /// [Specification](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md)
64    #[strum(serialize = "multivalue")]
65    Multivalue,
66    #[strum(serialize = "gc")]
67    Gc,
68    /// Large memory.
69    ///
70    /// [Specification](https://github.com/WebAssembly/memory64/blob/main/proposals/memory64/Overview.md).
71    #[strum(serialize = "memory64")]
72    Memory64,
73    /// Relaxed SIMD.
74    ///
75    /// [Specification](https://github.com/WebAssembly/relaxed-simd/tree/main/proposals/relaxed-simd).
76    #[strum(serialize = "relaxed-simd")]
77    RelaxedSimd,
78    /// Extended constant expressions.
79    ///
80    /// [Specification](https://github.com/WebAssembly/relaxed-simd/tree/main/proposals/relaxed-simd).
81    #[strum(serialize = "extended-const")]
82    ExtendedConst,
83    #[strum(serialize = "strings")]
84    Strings,
85    /// Multiple memory.
86    ///
87    /// [Specification](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md).
88    #[strum(serialize = "multi-memory")]
89    MultiMemory,
90    /// The original WebAssembly specification.
91    ///
92    /// It has the same value as `None`.
93    #[strum(disabled)]
94    Mvp,
95    /// The default feature set.
96    ///
97    /// Includes [`Feature::SignExt`] and [`Feature::MutableGlobals`].
98    #[strum(disabled)]
99    Default,
100    /// All features.
101    #[strum(disabled)]
102    All,
103}