Skip to main content

Transport

Trait Transport 

Source
pub trait Transport<W: Wire>:
    Clone
    + WasmCompatSend
    + WasmCompatSync
    + 'static {
    // Required method
    fn send(&self, payload: W::Payload, exchange: Exchange) -> Opening<W::Frame> ⓘ;
}
Expand description

Sends a wire’s payloads and delivers its replies’ frames.

HTTP clients (HttpClientExt) are transports for every wire that encodes Encoded requests and reads WireFrames. A local runtime, a proxy or a mock is a transport for the wires it serves.

Required Methods§

Source

fn send(&self, payload: W::Payload, exchange: Exchange) -> Opening<W::Frame> ⓘ

Open the reply to one payload. Nothing is sent until the opening is first polled. A payload the transport cannot send in the exchange’s mode fails the opening; a failure after the reply opened is its last frame.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Transport<Local<Embedding>> for MockEmbeddings

Available on crate feature test-utils only.
Source§

impl Transport<MockScript> for MockRuntime

Available on crate feature test-utils only.
Source§

impl<T> Transport<GenerateContent> for Caching<T>

Source§

impl<W, H> Transport<W> for H
where W: Wire<Payload = Encoded, Frame = WireFrame>, H: HttpClientExt + Clone + WasmCompatSend + WasmCompatSync + 'static,