Skip to main content

AsyncRemoteSource

Trait AsyncRemoteSource 

Source
pub trait AsyncRemoteSource:
    Send
    + Sync
    + 'static {
    // Required methods
    fn fetch(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Fetched, Error>> + Send + '_>>;
    fn describe(&self) -> String;
}
Available on crate feature async only.
Expand description

A remote store that is read asynchronously.

The right trait for a client that is async to begin with — etcd speaks gRPC and NATS is a streaming protocol, so both are. Used through refresh_remote_async().await.

The lifetime-bound boxed future rather than async fn: this trait is object-safe on purpose, so a configuration type can hold one without being generic over it.

Required Methods§

Source

fn fetch( &self, ) -> Pin<Box<dyn Future<Output = Result<Fetched, Error>> + Send + '_>>

Reads the current document.

§Errors

As RemoteSource::fetch.

Source

fn describe(&self) -> String

How to name this source in an error or a report.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§