JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Pre vtable changes

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨d17a4b2

⁨giterated-abi/src/vtable/setting.rs⁩ - ⁨776⁩ bytes
Raw
1 use crate::{
2 result::{Error, Result},
3 FfiSlice, FfiSliceRef,
4 };
5
6 use super::{ObjectABI, VTable};
7
8 #[repr(C)]
9 pub struct Setting {
10 inner: (),
11 vtable: &'static VTable<Setting>,
12 }
13
14 impl ObjectABI for Setting {
15 type VTable = SettingVTable;
16 }
17
18 pub struct SettingVTable {
19 pub serialize: unsafe extern "C" fn(this: Setting) -> Result<FfiSlice<[u8]>, Error>,
20 pub deserialize: unsafe extern "C" fn(buffer: FfiSliceRef<[u8]>) -> Result<Setting, Error>,
21 }
22
23 impl SettingVTable {
24 pub fn new<S: IntoSettingVTable>() -> Self {
25 todo!()
26 }
27 }
28
29 pub trait IntoSettingVTable {
30 unsafe extern "C" fn serialize(this: Setting) -> Result<FfiSlice<[u8]>, Error>;
31 unsafe extern "C" fn deserialize(buffer: FfiSliceRef<[u8]>) -> Result<Setting, Error>;
32 }
33