wast_encoder/wasi_values/
arithmetic.rs

1use super::*;
2
3impl Hash for WasiValue {
4    fn hash<H: Hasher>(&self, state: &mut H) {
5        match self {
6            WasiValue::Boolean(v) => {
7                "Boolean".hash(state);
8                v.hash(state)
9            }
10            WasiValue::Integer8(v) => {}
11            WasiValue::Integer16(v) => {}
12            WasiValue::Integer32(v) => {}
13            WasiValue::Integer64(v) => {}
14            WasiValue::Unsigned8(v) => {}
15            WasiValue::Unsigned16(v) => {}
16            WasiValue::Unsigned32(v) => {}
17            WasiValue::Unsigned64(v) => {}
18            WasiValue::Float32(v) => {}
19            WasiValue::Float64(v) => {}
20            WasiValue::DynamicArray { .. } => {}
21        }
22    }
23}
24
25impl Eq for WasiValue {}
26
27impl PartialEq<Self> for WasiValue {
28    fn eq(&self, other: &Self) -> bool {
29        todo!()
30    }
31}
32
33impl PartialOrd<Self> for WasiValue {
34    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
35        todo!()
36    }
37}
38
39impl Ord for WasiValue {
40    fn cmp(&self, other: &Self) -> Ordering {
41        todo!()
42    }
43}
44
45impl ToWasiType for WasiValue {
46    fn to_wasi_type(&self) -> WasiType {
47        match self {
48            Self::Boolean(_) => WasiType::Boolean,
49            Self::Integer8(_) => WasiType::Integer8 { signed: true },
50            Self::Integer16(_) => WasiType::Integer8 { signed: true },
51            Self::Integer32(_) => WasiType::Integer8 { signed: true },
52            Self::Integer64(_) => WasiType::Integer8 { signed: true },
53            Self::Unsigned8(_) => WasiType::Integer8 { signed: false },
54            Self::Unsigned16(_) => WasiType::Integer8 { signed: false },
55            Self::Unsigned32(_) => WasiType::Integer8 { signed: false },
56            Self::Unsigned64(_) => WasiType::Integer8 { signed: false },
57            Self::Float32(_) => WasiType::Float32,
58            Self::Float64(_) => WasiType::Float64,
59            Self::DynamicArray { r#type, .. } => WasiType::Array(Box::new(r#type.clone())),
60        }
61    }
62}