pub trait ClientBase<R, W>{
    // Required methods
    fn get_receiver<'a>(&'a mut self) -> (&'a mut R, &MutableCipher);
    fn get_sender<'a>(&'a mut self) -> (&'a mut W, &MutableCipher);

    // Provided methods
    fn send<'life0, 'life1, 'async_trait, B>(
        &'life0 mut self,
        message: &'life1 mut B
    ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
       where B: 'async_trait + Buf + Send,
             Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn recv<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<BytesMut, NetworkError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn send_recv<'life0, 'life1, 'async_trait, B>(
        &'life0 mut self,
        message: &'life1 mut B
    ) -> Pin<Box<dyn Future<Output = Result<BytesMut, NetworkError>> + Send + 'async_trait>>
       where B: 'async_trait + Buf + Send,
             Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn check_func<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        func: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

The basic trait for client. See ClientFactory for example.

Required Methods§

source

fn get_receiver<'a>(&'a mut self) -> (&'a mut R, &MutableCipher)

Get the receiver and mutable cipher.

§Note:

This should be a const expr.

source

fn get_sender<'a>(&'a mut self) -> (&'a mut W, &MutableCipher)

Get the sender and mutable cipher.

§Note:

This should be a const expr.

Provided Methods§

source

fn send<'life0, 'life1, 'async_trait, B>( &'life0 mut self, message: &'life1 mut B ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
where B: 'async_trait + Buf + Send, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message to the server.

source

fn recv<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<BytesMut, NetworkError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Recv a message from the server.

source

fn send_recv<'life0, 'life1, 'async_trait, B>( &'life0 mut self, message: &'life1 mut B ) -> Pin<Box<dyn Future<Output = Result<BytesMut, NetworkError>> + Send + 'async_trait>>
where B: 'async_trait + Buf + Send, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A shortcut of send and recv message.

source

fn check_func<'life0, 'life1, 'async_trait>( &'life0 mut self, func: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if the function is supported by the server.

This is corresponding to tcp-server crate.

Object Safety§

This trait is not object safe.

Implementors§