Skip to main content

RemoteSource

Trait RemoteSource 

Source
pub trait RemoteSource:
    Send
    + Sync
    + 'static {
    // Required methods
    fn fetch(&self) -> Result<Fetched, Error>;
    fn describe(&self) -> String;
}
Expand description

A remote store that can be read without an async runtime.

The right trait for anything with a plain HTTP API — Consul and Vault both are — because implementing it needs no runtime and using it needs no runtime either. fetch may block; it is called from refresh_remote(), never from load().

Required Methods§

Source

fn fetch(&self) -> Result<Fetched, Error>

Reads the current document.

§Errors

Whatever going wrong looks like for this store. Use Error::remote so the failure is categorised consistently.

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§