#[cfg(doc)]
use super::{Extern, RuntimeValue};
#[cfg(doc)]
use crate::Value;
use std::fmt::{self, Display};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bitcode", derive(bitcode::Encode, bitcode::Decode))]
#[non_exhaustive]
pub enum Type {
Null,
#[cfg(feature = "bool_type")]
Bool,
#[cfg(feature = "i32_type")]
I32,
#[cfg(feature = "f32_type")]
F32,
#[cfg(feature = "string_type")]
String,
#[cfg(feature = "extern_value_type")]
ExternValue,
ExternRef,
ExternMut,
}
impl Display for Type {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Null => "null",
#[cfg(feature = "bool_type")]
Self::Bool => "bool",
#[cfg(feature = "i32_type")]
Self::I32 => "i32",
#[cfg(feature = "f32_type")]
Self::F32 => "f32",
#[cfg(feature = "string_type")]
Self::String => "string",
#[cfg(feature = "extern_value_type")]
Self::ExternValue => "extern_value",
Self::ExternRef => "extern_ref",
Self::ExternMut => "extern_mut",
})
}
}