pub struct ExtismPluginAdapter { /* private fields */ }Expand description
Wraps an extism::Plugin and implements the diaryx_core plugin traits.
The guest WASM module communicates with the host through JSON payloads
defined in crate::protocol.
Implementations§
Source§impl ExtismPluginAdapter
impl ExtismPluginAdapter
Sourcepub fn new(
plugin: Plugin,
guest_manifest: GuestManifest,
config: JsonValue,
config_path: PathBuf,
) -> Self
pub fn new( plugin: Plugin, guest_manifest: GuestManifest, config: JsonValue, config_path: PathBuf, ) -> Self
Create a new adapter from an already-initialized Extism plugin.
The guest_manifest should have been obtained by calling the guest’s
manifest export. The config_path points to the JSON sidecar file
where plugin configuration is persisted.
Sourcepub fn call_guest(&self, func: &str, input: &str) -> Result<String, PluginError>
pub fn call_guest(&self, func: &str, input: &str) -> Result<String, PluginError>
Call a guest-exported function with a JSON input, returning the output string.
Sourcepub fn call_guest_binary(
&self,
func: &str,
input: &[u8],
) -> Result<Vec<u8>, PluginError>
pub fn call_guest_binary( &self, func: &str, input: &[u8], ) -> Result<Vec<u8>, PluginError>
Call a guest-exported function with binary input, returning raw bytes.
Used for hot-path binary exports (sync messages, CRDT updates).
Trait Implementations§
Source§impl FilePlugin for ExtismPluginAdapter
impl FilePlugin for ExtismPluginAdapter
Source§fn on_file_saved<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileSavedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_saved<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileSavedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a file is saved.
Source§fn on_file_created<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileCreatedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_created<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileCreatedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a file is created.
Source§fn on_file_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileDeletedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileDeletedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a file is deleted.
Source§fn on_file_moved<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileMovedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_moved<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 FileMovedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a file is moved/renamed.
Source§impl Plugin for ExtismPluginAdapter
impl Plugin for ExtismPluginAdapter
Source§fn manifest(&self) -> PluginManifest
fn manifest(&self) -> PluginManifest
Declarative manifest describing this plugin’s metadata and UI contributions.
Source§impl WorkspacePlugin for ExtismPluginAdapter
impl WorkspacePlugin for ExtismPluginAdapter
Source§fn on_workspace_opened<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceOpenedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_workspace_opened<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceOpenedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a workspace is opened.
Source§fn on_workspace_closed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceClosedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_workspace_closed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceClosedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a workspace is closed.
Source§fn on_workspace_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceChangedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_workspace_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceChangedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when workspace metadata changes.
Source§fn on_workspace_committed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceCommittedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_workspace_committed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceCommittedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a workspace is committed (e.g., git commit or sync checkpoint).
Source§fn handle_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
params: JsonValue,
) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
params: JsonValue,
) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a plugin-specific command. Read more
Source§fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<JsonValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<JsonValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get this plugin’s configuration (if any).
Source§fn set_config<'life0, 'async_trait>(
&'life0 self,
config: JsonValue,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_config<'life0, 'async_trait>(
&'life0 self,
config: JsonValue,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update this plugin’s configuration.
Source§fn notify_workspace_modified<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn notify_workspace_modified<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Called after a workspace-modifying operation completes. Read more
Source§fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_old_path: &'life1 str,
_new_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Sync + 'async_trait,
fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_old_path: &'life1 str,
_new_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Sync + 'async_trait,
Called when a body document needs to be renamed (file was moved/renamed). Read more
Source§fn on_body_doc_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn on_body_doc_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Called when a body document should be deleted. Read more
Source§fn track_file_for_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
_canonical_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn track_file_for_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
_canonical_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Called after a file operation to track CRDT metadata for echo detection. Read more
Source§fn track_content_for_sync(&self, _canonical_path: &str, _content: &str)
fn track_content_for_sync(&self, _canonical_path: &str, _content: &str)
Track body content for echo detection. Read more
impl Send for ExtismPluginAdapter
impl Sync for ExtismPluginAdapter
Auto Trait Implementations§
impl !Freeze for ExtismPluginAdapter
impl RefUnwindSafe for ExtismPluginAdapter
impl Unpin for ExtismPluginAdapter
impl UnsafeUnpin for ExtismPluginAdapter
impl UnwindSafe for ExtismPluginAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more