use std::{ffi::CStr, str::FromStr}; use crate::{ result::{FfiError, FfiResult}, value_ex::FfiValueUntyped, FfiSlice, FfiSliceRef, FfiValueRef, }; use super::{ObjectABI, VTable}; #[repr(C)] pub struct Object { inner: FfiValueUntyped, vtable: &'static VTable, } impl Object { pub fn home_uri(&self) -> String { todo!() } } impl From for Object { fn from(value: O) -> Self { todo!() } } impl ToString for Object { fn to_string(&self) -> String { todo!() } } impl FromStr for Object { type Err = FfiError; fn from_str(s: &str) -> Result { todo!() } } 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) -> FfiResult, pub home_uri: unsafe extern "C" fn(this: FfiValueRef) -> FfiSlice, } impl ObjectVTable { pub const fn new() -> Self { todo!() } } pub trait IntoObjectVTable: Sized { const VTABLE: &'static VTable = VTable::new(&ObjectVTable::new::()); fn object_kind() -> &'static CStr; unsafe extern "C" fn to_str(this: FfiValueRef) -> FfiSlice; unsafe extern "C" fn from_str(from: FfiSliceRef) -> FfiResult; unsafe extern "C" fn home_uri(this: FfiValueRef) -> FfiSlice; }