pub struct PluginHandle { /* private fields */ }Expand description
A handle to a specific plugin for making calls.
Implementations§
Source§impl PluginHandle
impl PluginHandle
Sourcepub async fn call_response(
&self,
entry: &str,
payload: &[u8],
) -> Result<(NrStatus, Vec<u8>)>
pub async fn call_response( &self, entry: &str, payload: &[u8], ) -> Result<(NrStatus, Vec<u8>)>
Call a plugin entry point with a request-response pattern.
Sourcepub async fn call_response_bytes(
&self,
entry: &str,
payload: &[u8],
) -> Result<(NrStatus, ResponseBytes)>
pub async fn call_response_bytes( &self, entry: &str, payload: &[u8], ) -> Result<(NrStatus, ResponseBytes)>
Like PluginHandle::call_response, but returns the response as a
ResponseBytes view instead of a Vec<u8>.
For a plugin that responds with plugin-owned bytes this is zero-copy: the buffer is only released back to the plugin when the view drops, and the view holds an in-flight call guard so the plugin cannot be unloaded from under it.
Sourcepub async fn call_response_timeout(
&self,
entry: &str,
payload: &[u8],
timeout: Duration,
) -> Result<(NrStatus, Vec<u8>)>
pub async fn call_response_timeout( &self, entry: &str, payload: &[u8], timeout: Duration, ) -> Result<(NrStatus, Vec<u8>)>
Like PluginHandle::call_response but bounded by a timeout.
If the plugin does not deliver a response within timeout, the pending
entry is removed from the host’s tracking map and Err(Timeout) is
returned. Use this for any production caller that cannot afford to
hang indefinitely on a misbehaving plugin.
Sourcepub async fn call_response_fast(
&self,
entry: &str,
payload: &[u8],
) -> Result<(NrStatus, Vec<u8>)>
pub async fn call_response_fast( &self, entry: &str, payload: &[u8], ) -> Result<(NrStatus, Vec<u8>)>
Ultra-fast unary call for synchronous plugins.
Sourcepub async fn call(&self, entry: &str, payload: &[u8]) -> Result<NrStatus>
pub async fn call(&self, entry: &str, payload: &[u8]) -> Result<NrStatus>
Fire-and-forget call to a plugin entry point.
Sourcepub async fn call_stream(
&self,
entry: &str,
payload: &[u8],
) -> Result<(u64, StreamReceiver)>
pub async fn call_stream( &self, entry: &str, payload: &[u8], ) -> Result<(u64, StreamReceiver)>
Call a plugin entry point with a streaming response pattern.
Sourcepub fn send_stream_data(&self, sid: u64, data: &[u8]) -> Result<NrStatus>
pub fn send_stream_data(&self, sid: u64, data: &[u8]) -> Result<NrStatus>
Send data to an active stream.
Sourcepub fn close_stream(&self, sid: u64) -> Result<NrStatus>
pub fn close_stream(&self, sid: u64) -> Result<NrStatus>
Close an active stream from the host side.
Sourcepub fn entry(&self, entry: &str) -> Result<PluginEntry>
pub fn entry(&self, entry: &str) -> Result<PluginEntry>
Resolve an entry name to a PluginEntry that dispatches by
integer id, skipping the per-call name comparison.
The id stays valid for this loaded plugin instance; a handle created
before a reload keeps calling the instance it resolved against, the
same snapshot semantics as PluginHandle itself. Fails with
NylonRingHostError::EntryDispatchUnsupported for v1 plugins and
NylonRingHostError::EntryNotFound for names the plugin does not
export.
Trait Implementations§
Source§impl Clone for PluginHandle
impl Clone for PluginHandle
Source§fn clone(&self) -> PluginHandle
fn clone(&self) -> PluginHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more