Skip to main content

ControlChannelClient

Trait ControlChannelClient 

pub trait ControlChannelClient: Send {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn connect(
        &mut self,
        endpoint: &OsStr,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn send(
        &mut self,
        bytes: &[u8],
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn recv(
        &mut self,
        buf: &mut [u8],
    ) -> impl Future<Output = Result<usize, Self::Error>> + Send;
}
Expand description

Client endpoint of the daemon-to-client control channel.

Each client process owns one ControlChannelClient connected to the daemon-side ControlChannelServer.

Required Associated Types§

type Error: Error + Send + Sync + 'static

Error type returned by control-channel operations.

Required Methods§

fn connect( &mut self, endpoint: &OsStr, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Connect to the daemon’s control-channel endpoint identified by endpoint.

§Arguments
  • endpoint - Platform-specific endpoint identifier (named pipe name on Windows, UNIX socket path on Linux/macOS).

fn send( &mut self, bytes: &[u8], ) -> impl Future<Output = Result<(), Self::Error>> + Send

Send raw bytes to the daemon.

§Arguments
  • bytes - Payload to write; the trait performs no framing.

fn recv( &mut self, buf: &mut [u8], ) -> impl Future<Output = Result<usize, Self::Error>> + Send

Read up to buf.len() bytes from the daemon into buf.

§Arguments
  • buf - Destination buffer.
§Returns

Number of bytes written into buf. Ok(0) signals EOF (the daemon closed the connection cleanly); any transport-level failure is reported as Err.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§