use crate::{ result::{FfiError, FfiResult}, value_ex::FfiValueUntyped, FfiSlice, FfiSliceRef, }; use super::{ObjectABI, VTable}; #[repr(C)] pub struct Setting { inner: FfiValueUntyped, vtable: &'static VTable, } impl From for Setting { fn from(value: T) -> Self { todo!() } } impl ObjectABI for Setting { type VTable = SettingVTable; } pub struct SettingVTable { pub serialize: unsafe extern "C" fn(this: Setting) -> FfiResult, FfiError>, pub deserialize: unsafe extern "C" fn(buffer: FfiSliceRef<[u8]>) -> FfiResult, } impl SettingVTable { pub const fn new() -> Self { Self { serialize: S::serialize, deserialize: S::deserialize, } } pub fn serialize(&self, setting: Setting) -> Result, FfiError> { todo!() } pub fn deserialize(&self, buffer: &[u8]) -> Result { todo!() } } pub trait IntoSettingVTable: Sized { const VTABLE: &'static VTable = VTable::new(&SettingVTable::new::()); unsafe extern "C" fn serialize(this: Setting) -> FfiResult, FfiError>; unsafe extern "C" fn deserialize(buffer: FfiSliceRef<[u8]>) -> FfiResult; }