Skip to main content

GenericClient

Trait GenericClient 

Source
pub trait GenericClient<C, R>: Debug + Send {
    // Required methods
    fn send(&mut self, cmd: C) -> impl Future<Output = Result<(), Error>> + Send;
    fn poll_recv(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<Option<R>, Error>>;

    // Provided method
    fn recv(&mut self) -> impl Future<Output = Result<Option<R>, Error>> + Send { ... }
}
Expand description

A generic client to a server that receives commands and asynchronously produces responses.

Required Methods§

Source

fn send(&mut self, cmd: C) -> impl Future<Output = Result<(), Error>> + Send

Sends a command to the dataflow server.

The command can error for various reasons.

Source

fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<R>, Error>>

Polls for the next response from the dataflow server.

Returns Poll::Pending and schedules cx for a wakeup if no response is available. Ready values have the same meaning as for GenericClient::recv.

Provided Methods§

Source

fn recv(&mut self) -> impl Future<Output = Result<Option<R>, Error>> + Send

Receives the next response from the dataflow server.

This method blocks until the next response is available.

A return value of Ok(Some(_)) transmits a response.

A return value of Ok(None) indicates graceful termination of the connection. The owner of the client should not call recv again.

A return value of Err(_) indicates an unrecoverable error. After observing an error, the owner of the client must drop the client.

Implementations of this method must be cancellation safe. That means that work must not be lost if the future returned by this method is dropped.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<C, R> GenericClient<C, R> for LocalClient<C, R>
where C: Debug + Send, R: Debug + Send,

Source§

impl<Out: Message, In: Message> GenericClient<Out, In> for Client<Out, In>

Source§

impl<P, C, R> GenericClient<C, R> for Partitioned<P, C, R>
where P: GenericClient<C, R>, (C, R): Partitionable<C, R>, C: Debug + Send, R: Debug + Send,