Skip to main content

IpcHandler

Trait IpcHandler 

Source
pub trait IpcHandler: Send + Sync {
    // Required method
    fn handle(&self, message: IpcMessage) -> IpcResponse;

    // Provided method
    fn handle_async(&self, message: IpcMessage, respond: IpcResponseSender) { ... }
}
Expand description

Handler for IPC messages from the frontend.

Required Methods§

Source

fn handle(&self, message: IpcMessage) -> IpcResponse

Handle an IPC message and return a response.

Provided Methods§

Source

fn handle_async(&self, message: IpcMessage, respond: IpcResponseSender)

Handle an IPC message without blocking the renderer event loop.

Renderers invoke this method from a worker thread. Existing handlers remain synchronous by default, while handlers that already use an async runtime can override this method and call respond when their operation completes. Responses are correlated by IpcResponse.id, so asynchronous replies may safely arrive out of order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§