pub trait Transport {
// Required method
fn run(&self, input: RunAgentInput) -> TransportFuture;
}Expand description
Somewhere an agent’s events come from.
One method. A transport does not decode, check or translate anything: it
connects and returns the stream in the form it has it, and the client
applies the compatibility boundary. See TransportStream for the two
forms.
§Why the future is 'static
A transport is usually held inside a Thread, 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 thread 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§
Sourcefn run(&self, input: RunAgentInput) -> TransportFuture
fn run(&self, input: RunAgentInput) -> TransportFuture
Starts a run and connects to its 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".