Skip to main content

IpcHandler

Trait IpcHandler 

Source
pub trait IpcHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        request: IpcRequest,
    ) -> Pin<Box<dyn Future<Output = IpcResponse> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe_events(&self) -> Receiver<DnsEvent>;
}
Expand description

Implemented by the daemon’s shared state to handle incoming IPC requests.

The implementation receives decoded requests and returns encoded responses. It also provides a broadcast receiver for the event stream used by IpcServer to forward events to subscribed clients.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, request: IpcRequest, ) -> Pin<Box<dyn Future<Output = IpcResponse> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process a single request and return a response.

Source

fn subscribe_events(&self) -> Receiver<DnsEvent>

Subscribe to the internal event broadcast channel.

Each call returns an independent receiver. The server creates one per subscriber connection.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§