pub struct EchoClient<T, L = Root> { /* 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.
A one-item method is an async fn returning Result<item, ClientError>; a many-item method returns a MethodStream. The parameter and item types are the activation’s own, so a change to either 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: impl Into<RoutePath>) -> Self
pub fn at(transport: T, path: impl Into<RoutePath>) -> Self
Wrap a transport, for this activation mounted at path —
the dotted route from the service, e.g. "tickets.inputs"
for a #[child]. new is at(transport, NAMESPACE). Its
events are this activation’s own aggregate; a parent’s child
accessor builds one whose events are the parent’s.
Source§impl<T, L> EchoClient<T, L>
impl<T, L> EchoClient<T, L>
Sourcepub fn lifted(transport: T, route: Route, lift: L) -> Self
pub fn lifted(transport: T, route: Route, lift: L) -> Self
RETURNS-46: a client on route whose calls’ .events() are
lifted by lift — what a parent’s child accessor builds
(TreeClient::branch() lifts into TreeEvent).
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &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.
Source§impl<T: Transport, L: Lift<EchoAggregate>> EchoClient<T, L>
impl<T: Transport, L: Lift<EchoAggregate>> EchoClient<T, L>
Sourcepub fn echo(
&self,
message: Message,
count: u32,
) -> MethodStream<'_, EchoEvent, NoProgress, EchoAggregate, L, __EchoClientEcho>
pub fn echo( &self, message: Message, count: u32, ) -> MethodStream<'_, EchoEvent, NoProgress, EchoAggregate, L, __EchoClientEcho>
Echo a message back the specified number of times
Calls echo.echo.
Many items, as a stream of Result<item, ClientError> — a [EchoEchoStream]; progress is dropped unless opted in with .with_progress(), and .events() yields EchoAggregate::Echo — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).
Sourcepub fn once(
&self,
message: Message,
) -> MethodStream<'_, EchoEvent, NoProgress, EchoAggregate, L, __EchoClientOnce>
pub fn once( &self, message: Message, ) -> MethodStream<'_, EchoEvent, NoProgress, EchoAggregate, L, __EchoClientOnce>
Echo a message once
Calls echo.once.
Many items, as a stream of Result<item, ClientError> — a [EchoOnceStream]; progress is dropped unless opted in with .with_progress(), and .events() yields EchoAggregate::Once — lifted by L into the aggregate of the client this one was reached from (RETURNS-46).