Rust

How adapters reach provider APIs: a Call (or a Multi of concurrent calls) goes to a Requester, which answers with a Reply.

Contents

use utopia_messaging::Call;
Rust
pub struct Call

One request an adapter makes.

use utopia_messaging::Http;
Rust
pub struct Http

The default [Requester]: encodes, sends and decodes over HTTP.

Also implements Debug.
use utopia_messaging::Multi;
Rust
pub struct Multi

Requests an adapter sends at once: one per URL and body, either side repeated when it holds a single entry.

use utopia_messaging::Reply;
Rust
pub struct Reply

A provider's answer, or the transport failure that stood in its way.

use utopia_messaging::Requester;
Rust
pub trait Requester: Send + Sync

Performs an adapter's requests. Implement it to answer them some other way (canned replies in tests, a proxy, a queue).

Implemented byHttp
use utopia_messaging::Transport;
Rust
pub trait Transport: Send + Sync

Sends an HTTP request: any utopia_client client, or a transport of your own.

Implemented byClientArcHttp2
Rust
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>

A boxed future, for the object-safe traits of this crate.

Rust
pub type OnResult<'a> = dyn Fn(Reply) -> Result<(), Error> + Send + Sync + 'a

Takes each reply of a Multi as its request completes.

Rust
pub const MAX_CONCURRENT_REQUESTS: usize = 25

The most requests a Multi keeps in flight.