pub trait Handler:
Send
+ Sync
+ 'static {
// Required method
fn handle<'a>(
&'a self,
cx: &'a HandlerCtx,
) -> Pin<Box<dyn Future<Output = NotifAction> + Send + 'a>>;
}Expand description
Public extension trait for sandlock seccomp-notif handlers.
Each implementor is registered against a crate::seccomp::syscall::Syscall
through crate::Sandbox::run_with_handlers /
crate::Sandbox::run_interactive_with_handlers. Receives
&HandlerCtx borrowed for the call; cannot outlive the dispatch
invocation.
State lives on the implementor — no Arc::clone ladders, no
closure ceremony at registration time.
handle returns a boxed Future so the trait stays dyn-compatible
(the supervisor stores user handlers as Vec<Arc<dyn Handler>>,
keyed by syscall number). Returning impl Future directly via
RPITIT would be more efficient but is not object-safe, and changing
the storage to a non-erased shape would force a generic dispatch
chain incompatible with arbitrary user handler types.
Required Methods§
fn handle<'a>( &'a self, cx: &'a HandlerCtx, ) -> Pin<Box<dyn Future<Output = NotifAction> + Send + 'a>>
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".