Skip to main content

Transport

Trait Transport 

Source
pub trait Transport {
    // Required method
    fn run(&self, input: RunAgentInput) -> TransportFuture;
}
Expand description

Somewhere an agent’s events come from.

§Why the future is 'static

A transport is usually held inside a Session, which mutates its own state as events arrive. If the returned future borrowed the transport, that borrow would live as long as the run and the session could not touch itself while streaming. So run clones what it needs — reqwest::Client is explicitly designed for exactly that — and the future stands alone.

Required Methods§

Source

fn run(&self, input: RunAgentInput) -> TransportFuture

Starts a run and connects to its event stream.

Failing to connect is an error from the future; failing mid-stream is an error item in the stream.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Transport + ?Sized> Transport for &T

Source§

impl<T: Transport + ?Sized> Transport for Arc<T>

Source§

impl<T: Transport + ?Sized> Transport for Box<T>

Implementors§