Skip to main content

ExtismPluginAdapter

Struct ExtismPluginAdapter 

Source
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

Source

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.

Source

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.

Source

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

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,

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,

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,

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,

Called after a file is moved/renamed.
Source§

impl Plugin for ExtismPluginAdapter

Source§

fn id(&self) -> PluginId

Unique identifier for this plugin.
Source§

fn manifest(&self) -> PluginManifest

Declarative manifest describing this plugin’s metadata and UI contributions.
Source§

fn init<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize the plugin with the given context.
Source§

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shut down the plugin, releasing any resources.
Source§

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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)

Track body content for echo detection. Read more
Source§

fn get_canonical_path(&self, _storage_path: &str) -> Option<String>

Resolve a canonical path from a storage path. Read more
Source§

fn get_file_title(&self, _canonical_path: &str) -> Option<String>

Get the title for a file from CRDT metadata. Read more
Source§

impl Send for ExtismPluginAdapter

Source§

impl Sync for ExtismPluginAdapter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetSetFdFlags for T

Source§

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,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

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 more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more