pub struct RemoteAgent<T> { /* private fields */ }Expand description
A remote agent, over any Transport.
HttpAgent is this over HTTP; the type is generic so that a wasm
transport, an in-process agent, or a recorded fixture substitutes without
anything above noticing.
§Not crate::server::Agent
The two crates sit on opposite ends of the same wire, and the word “agent”
means the opposite thing at each end, so they do not share a name.
crate::server::Agent is a trait you implement to be an agent;
RemoteAgent is a handle you hold onto someone else’s. An agent that calls
another agent — the composition case — needs both in one file, and
impl Agent for X { … self.upstream: RemoteAgent<_> … } reads correctly
only because they are spelled differently.
Implementations§
Source§impl<T> RemoteAgent<T>
impl<T> RemoteAgent<T>
Source§impl<T: Transport> RemoteAgent<T>
impl<T: Transport> RemoteAgent<T>
Sourcepub fn run(&self, params: impl Into<RunAgentInput>) -> EventStream
pub fn run(&self, params: impl Into<RunAgentInput>) -> EventStream
Starts a run and streams its events, exactly as the agent sent them.
Nothing is normalized, verified or assembled here — chunk events arrive
as chunk events. That is what a proxy wants; a UI wants
Session.
Connecting is folded into the stream: a transport that cannot reach the agent yields one error item and ends.
Trait Implementations§
Source§impl<T: Clone> Clone for RemoteAgent<T>
impl<T: Clone> Clone for RemoteAgent<T>
Source§fn clone(&self) -> RemoteAgent<T>
fn clone(&self) -> RemoteAgent<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more