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

ambee/giterated

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

More progress :)

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨92c3f32

⁨giterated-plugin/src/vtable/runtime.rs⁩ - ⁨836⁩ bytes
Raw
1 use giterated_models::error::OperationError;
2
3 use crate::{future::RuntimeFuture, new_stack::PluginState, AnyFailure, AnySuccess, FFIBox};
4
5 #[derive(Clone, Copy)]
6 pub struct RuntimeVTable {
7 pub(crate) runtime: PluginState,
8 pub(crate) handle_fn: unsafe extern "C" fn(
9 PluginState,
10 FFIBox<str>,
11 FFIBox<str>,
12 FFIBox<str>,
13 FFIBox<[u8]>,
14 FFIBox<[u8]>,
15 ) -> RuntimeFuture<
16 Result<AnySuccess, OperationError<AnyFailure>>,
17 >,
18 }
19
20 pub trait IntoRuntimeVtable {
21 unsafe extern "C" fn handle(
22 this: PluginState,
23 object_kind: FFIBox<str>,
24 operation_name: FFIBox<str>,
25 object: FFIBox<str>,
26 operation_payload: FFIBox<[u8]>,
27 operation_state: FFIBox<[u8]>,
28 ) -> RuntimeFuture<Result<AnySuccess, OperationError<AnyFailure>>>;
29 }
30