Skip to main content

WireClientExt

Trait WireClientExt 

Source
pub trait WireClientExt: WireClient {
    // Provided methods
    fn read_message(
        &mut self,
    ) -> impl Future<Output = Result<WireMessage, WireError>> + Send { ... }
    fn read_message_timeout(
        &mut self,
        timeout: Duration,
    ) -> impl Future<Output = Result<WireMessage, WireError>> + Send { ... }
}
Expand description

Convenience extensions for any WireClient implementation.

This trait is automatically implemented for every type that already implements WireClient, so you can call .read_message() on InMemoryWireClient, TransportWireClient, or any custom backend.

Provided Methods§

Source

fn read_message( &mut self, ) -> impl Future<Output = Result<WireMessage, WireError>> + Send

Read the next incoming message and parse it into a WireMessage.

§Errors

Returns WireError::JsonParse if the raw message cannot be deserialized into a known request / event type.

Source

fn read_message_timeout( &mut self, timeout: Duration, ) -> impl Future<Output = Result<WireMessage, WireError>> + Send

Read the next incoming message with a timeout.

If no message arrives within timeout, returns WireError::Timeout.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§