1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
//! Defines WIT values and associated operations.
use crate::ne_vec::NEVec;
use variant_count::VariantCount;
/// A WIT value.
#[derive(Debug, Clone, PartialEq, VariantCount)]
pub enum IValue {
/// Boolean value.
Boolean(bool),
/// A 8-bits signed integer.
S8(i8),
/// A 16-bits signed integer.
S16(i16),
/// A 32-bits signed integer.
S32(i32),
/// A 64-bits signed integer.
S64(i64),
/// A 8-bits unsigned integer.
U8(u8),
/// A 16-bits unsigned integer.
U16(u16),
/// A 32-bits unsigned integer.
U32(u32),
/// A 64-bits unsigned integer.
U64(u64),
/// A 32-bits float.
F32(f32),
/// A 64-bits float.
F64(f64),
/// A string.
String(String),
/// Specialization of array type for byte vector.
ByteArray(Vec<u8>),
/// A byte array.
Array(Vec<IValue>),
/// A 32-bits integer (as defined in WebAssembly core).
I32(i32),
/// A 64-bits integer (as defined in WebAssembly core).
I64(i64),
/// A record.
Record(NEVec<IValue>),
}
impl Default for IValue {
fn default() -> Self {
Self::I32(0)
}
}