pub trait Extension: Send + Sync {
// Required methods
fn namespace(&self) -> &str;
fn handle_request<'a>(
&'a self,
ctx: ExtensionContext<'a>,
payload: Vec<u8>,
) -> ExtensionFuture<'a, ExtensionResponse>;
// Provided methods
fn on_vm_created<'a>(
&'a self,
_ctx: ExtensionSnapshot,
) -> ExtensionFuture<'a, ()> { ... }
fn on_session_disposed<'a>(
&'a self,
_ctx: ExtensionSnapshot,
) -> ExtensionFuture<'a, ()> { ... }
fn is_blocking_request(&self, _payload: &[u8]) -> bool { ... }
fn interrupt_blocking_request(
&self,
_blocking_payload: &[u8],
_interrupt: ExtensionInterruptRequest<'_>,
) -> Option<ExtensionInterruptResponse> { ... }
fn on_dispose<'a>(&'a self) -> ExtensionFuture<'a, ()> { ... }
}Required Methods§
fn namespace(&self) -> &str
fn handle_request<'a>( &'a self, ctx: ExtensionContext<'a>, payload: Vec<u8>, ) -> ExtensionFuture<'a, ExtensionResponse>
Provided Methods§
fn on_vm_created<'a>( &'a self, _ctx: ExtensionSnapshot, ) -> ExtensionFuture<'a, ()>
Sourcefn on_session_disposed<'a>(
&'a self,
_ctx: ExtensionSnapshot,
) -> ExtensionFuture<'a, ()>
fn on_session_disposed<'a>( &'a self, _ctx: ExtensionSnapshot, ) -> ExtensionFuture<'a, ()>
Per-session teardown hook. The host invokes this for every registered
extension when a session is disposed because its connection closed
(DisposeReason::ConnectionClosed), giving the extension the disposed
session’s ownership scope so it can release the per-session state it
keyed on that session. Default is a no-op. This is the only signal an
extension receives that a client has disconnected, so it is what lets an
ACP-style extension free per-session state instead of leaking it for the
process lifetime.
fn is_blocking_request(&self, _payload: &[u8]) -> bool
fn interrupt_blocking_request( &self, _blocking_payload: &[u8], _interrupt: ExtensionInterruptRequest<'_>, ) -> Option<ExtensionInterruptResponse>
fn on_dispose<'a>(&'a self) -> ExtensionFuture<'a, ()>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".