Skip to main content

Module export

Module export 

Source
Expand description

Wraps a Box<dyn Plugin> into the exported foldit_plugin_vtable symbol the host dlopens.

Marshalling lives in free functions here so it is unit-testable; the export_plugin! macro only emits the extern "C" entry points and the static vtable.

Functions§

assets_from_c
Safety
buffer_from_vec
Hand a Vec<u8> to the host. Ownership transfers; the host returns it through free_buffer, which reconstructs the Vec from the recorded capacity.
ctx_from_c
Safety
drop_buffer
Release a buffer previously produced by buffer_from_vec.
drop_error
Release both inner buffers of an error this plugin allocated.
encode_to_buffer
Encode a prost message into a host-owned buffer.
guard
Run plugin code, converting a panic into an error rather than unwinding across the FFI boundary (which is UB).
params_from_c
Unspecified entries are dropped: the ABI treats them as “skip”.
poll_outcome_to_proto
poll_stream is the one vtable slot whose payload is proto-encoded.
report_error
Populate out_err and pick the status the host should see. Unsupported maps to the dedicated status so the host can distinguish “plugin has no streaming” from “streaming failed”.
slice_from_raw
Safety
write_error
Safety

Type Aliases§

BoxedPlugin
Handle payload behind crate::abi::FolditPluginHandle: a thin pointer to the boxed trait object (the trait object itself is a fat pointer and cannot be cast to *mut c_void directly).