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).
Trait Implementations§
Source§impl<T, L> Aggregated for EchoClient<T, L>
impl<T, L> Aggregated for EchoClient<T, L>
Source§impl<T: Debug, L> Debug for EchoClient<T, L>
impl<T: Debug, L> Debug for EchoClient<T, L>
Source§impl<T: Default> Default for EchoClient<T>
impl<T: Default> Default for EchoClient<T>
Source§impl<T> FromRoute<T> for EchoClient<T>
impl<T> FromRoute<T> for EchoClient<T>
Source§fn from_route(transport: T, route: Route) -> Self
fn from_route(transport: T, route: Route) -> Self
route, over transport.Source§impl<__T, __L> ParentHash for EchoClient<__T, __L>
impl<__T, __L> ParentHash for EchoClient<__T, __L>
Source§impl<__T, __L> ParentShape for EchoClient<__T, __L>
impl<__T, __L> ParentShape for EchoClient<__T, __L>
Source§fn resolve(segments: &[&str]) -> Option<(String, Option<String>)>
fn resolve(segments: &[&str]) -> Option<(String, Option<String>)>
segments are a call chain’s names as the Rust code wrote them
(["ui", "slots", "list", "collect"]). The wire path of the method the
chain calls, below this client’s node ("ui.slots.list"), and its
shape hash where known; None when the chain names no method of this
client (a dynamic child’s or a peer slot’s accessor, which take a name
only known when the code runs).Source§impl<__T, __L> ShapeCheck for EchoClient<__T, __L>
impl<__T, __L> ShapeCheck for EchoClient<__T, __L>
Source§fn shape_check(path: &str, schema: &Value) -> Result<(), ClientError>
fn shape_check(path: &str, schema: &Value) -> Result<(), ClientError>
Ok when schema — the node at path’s answer to schema — serves
every method this client calls under the same shape; else
ClientError::ShapeMismatch naming those it does not.