Skip to main content

ProxySocket

Trait ProxySocket 

Source
pub trait ProxySocket {
    // Required methods
    fn recv_multipart<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, Error>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn send_multipart<'life0, 'async_trait>(
        &'life0 mut self,
        msg: Vec<Bytes>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn socket_desc(&self) -> &'static str;
}
Expand description

Socket types that can participate in a proxy.

Sockets must implement multipart message send/receive operations to be used in a proxy pattern.

Note: This trait is designed for single-threaded async runtimes like compio and does not require Send.

Required Methods§

Source

fn recv_multipart<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, Error>> + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Receive a multipart message from the socket.

Returns None if no message is available or connection closed.

Source

fn send_multipart<'life0, 'async_trait>( &'life0 mut self, msg: Vec<Bytes>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Send a multipart message to the socket.

§Errors

Returns an error if the send operation fails.

Source

fn socket_desc(&self) -> &'static str

Get a description of the socket for logging.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§