pub struct EchoClient<T> { /* private fields */ }Expand description
Typed client for the echo activation, generated by #[plexus_macros::activation(client)].
Generic over the transport: construct it with any plexus_client::Transport — in-process for tests, WebSocket JSON-RPC or REST + SSE against a server.
The parameter and event types are the activation’s own, so a change to a method or an event is a compile error here, not a runtime surprise.
Implementations§
Source§impl<T> EchoClient<T>
impl<T> EchoClient<T>
Sourcepub fn at(transport: T, path: &'static str) -> Self
pub fn at(transport: T, path: &'static str) -> Self
Wrap a transport, for this activation mounted at path —
the dotted route from the hub, e.g. "tickets.inputs" for a
#[child]. A parent’s child accessor builds this; new is
at(transport, NAMESPACE).
Sourcepub fn path(&self) -> &'static str
pub fn path(&self) -> &'static str
The dotted path this client’s calls go to: the namespace, or the child path it was built at.
Sourcepub fn transport(&self) -> &T
pub fn transport(&self) -> &T
Borrow the underlying transport — for reading a
MemoryTransport‘s recorded calls, or sharing one transport
across several activations’ clients.
Sourcepub fn into_transport(self) -> T
pub fn into_transport(self) -> T
Unwrap the transport.
Source§impl<T: Transport> EchoClient<T>
impl<T: Transport> EchoClient<T>
Sourcepub const METHOD_ECHO: MethodRef
pub const METHOD_ECHO: MethodRef
Echo a message back the specified number of times
Calls echo.echo.
Sourcepub const METHOD_ONCE: MethodRef
pub const METHOD_ONCE: MethodRef
Echo a message once
Calls echo.once.
Sourcepub fn echo(&self, message: Message, count: u32) -> EventStream<'_, EchoEvent>
pub fn echo(&self, message: Message, count: u32) -> EventStream<'_, EchoEvent>
Echo a message back the specified number of times
Calls echo.echo.
Sourcepub async fn echo_all(
&self,
message: Message,
count: u32,
) -> Result<Vec<EchoEvent>, ClientError>
pub async fn echo_all( &self, message: Message, count: u32, ) -> Result<Vec<EchoEvent>, ClientError>
Echo a message back the specified number of times
Calls echo.echo.
Drives the stream to completion and collects every data event.
Sourcepub fn once(&self, message: Message) -> EventStream<'_, EchoEvent>
pub fn once(&self, message: Message) -> EventStream<'_, EchoEvent>
Echo a message once
Calls echo.once.