use std::ffi::CStr; use crate::{ result::{Error, Result}, FfiSlice, FfiSliceRef, FfiValueRef, }; use super::{ObjectABI, VTable}; #[repr(C)] pub struct Object { inner: (), vtable: &'static VTable, } impl ObjectABI for Object { type VTable = ObjectVTable; } pub struct ObjectVTable { pub object_kind: &'static CStr, pub to_str: unsafe extern "C" fn(this: FfiValueRef) -> FfiSlice, pub from_str: unsafe extern "C" fn(from: FfiSliceRef) -> Result, pub home_uri: unsafe extern "C" fn(this: FfiValueRef) -> FfiSlice, } impl ObjectVTable { pub fn new() -> Self { todo!() } } pub trait IntoObjectVTable { fn object_kind() -> &'static CStr; unsafe extern "C" fn to_str(this: FfiValueRef) -> FfiSlice; unsafe extern "C" fn from_str(from: FfiSliceRef) -> Result; unsafe extern "C" fn home_uri(this: FfiValueRef) -> FfiSlice; }