use std::ffi::c_void;
use std::ptr;
#[derive(Clone, Copy, Debug)]
pub enum Value {
Bool(bool),
I32(i32),
I64(i64),
F32(f32),
F64(f64),
Object(*mut c_void),
}
impl Value {
pub(crate) fn as_arg_ptr(&self) -> *mut c_void {
match self {
Self::Bool(v) => ptr::from_ref(v).cast_mut().cast(),
Self::I32(v) => ptr::from_ref(v).cast_mut().cast(),
Self::I64(v) => ptr::from_ref(v).cast_mut().cast(),
Self::F32(v) => ptr::from_ref(v).cast_mut().cast(),
Self::F64(v) => ptr::from_ref(v).cast_mut().cast(),
Self::Object(p) => *p,
}
}
}