Skip to main content

IpcClient

Trait IpcClient 

Source
pub trait IpcClient: Send + Sync {
    // Required methods
    fn start<'life0, 'async_trait>(
        &'life0 self,
        cancellation_token: Option<CancellationToken>,
    ) -> Pin<Box<dyn Future<Output = Result<(), AlreadyRunningError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_running(&self) -> bool;
    fn send<'life0, 'async_trait>(
        &'life0 self,
        message: OutgoingMessage,
    ) -> Pin<Box<dyn Future<Output = Result<(), SendError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
        topic: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<IpcClientSubscription, SubscribeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Dyn-compatible trait for IPC client operations.

This trait provides the core IPC operations that consumers can use without being tied to a specific concrete IpcClient implementation. For generic convenience methods (typed subscriptions, RPC requests), use the IpcClientExt extension trait which is automatically implemented for all IpcClient implementors.

Required Methods§

Source

fn start<'life0, 'async_trait>( &'life0 self, cancellation_token: Option<CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), AlreadyRunningError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the IPC client, which will begin listening for incoming messages and processing them.

Source

fn is_running(&self) -> bool

Check if the IPC client task is currently running.

Source

fn send<'life0, 'async_trait>( &'life0 self, message: OutgoingMessage, ) -> Pin<Box<dyn Future<Output = Result<(), SendError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a message over IPC.

Returning an error means this particular send failed. The client only stops processing messages when the underlying error is fatal (see IpcErrorKind); recoverable errors leave the client running, so the send can be retried and existing subscriptions remain valid.

Source

fn subscribe<'life0, 'async_trait>( &'life0 self, topic: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<IpcClientSubscription, SubscribeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to receive messages, optionally filtered by topic. Setting the topic to None will receive all messages.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Crypto, Com, Ses> IpcClient for IpcClientImpl<Crypto, Com, Ses>
where Crypto: CryptoProvider<Com, Ses>, Com: CommunicationBackend, Ses: SessionRepository<Crypto::Session>,