pub struct MethodRef { /* private fields */ }Expand description
A fully qualified Plexus method — the activation namespace and the method name, kept as separate fields because the transports need them differently:
| Transport | Uses |
|---|---|
| WebSocket JSON-RPC | "{path}.{method}" as the params.method of a {service}.call subscription |
| REST + SSE | POST /rest/{namespace}/{method} |
| in-process | namespace selects the activation, method is passed to Activation::call |
A pre-joined &str would force every transport to re-split it, and a
mis-split is silent. The generated client emits MethodRef::new(..) as a
const, so this costs nothing at the call site.
MACRO-16: a method of a #[child] activation is reached through its
parent — tickets.inputs.answer, not inputs.answer. MethodRef::at
gives the reference the dotted path the activation is mounted at
("tickets.inputs"); MethodRef::qualified then answers
"{path}.{method}". Without a path (every MethodRef::new) the path is
the namespace, exactly as before.
RETURNS-46: the path is a RoutePath — a dynamic instance’s path is a
run-time value — so a MethodRef is Clone, not Copy.
Implementations§
Source§impl MethodRef
impl MethodRef
pub const fn new(namespace: &'static str, method: &'static str) -> Self
Sourcepub fn named(path: impl Into<RoutePath>, method: impl Into<RoutePath>) -> Self
pub fn named(path: impl Into<RoutePath>, method: impl Into<RoutePath>) -> Self
NEST-14: method on the node at the dotted path, both known only
at run time — what an untyped client (crate::Untyped) sends. The
path stands for the namespace too: qualified() is path.method.
Sourcepub fn at(self, path: impl Into<RoutePath>) -> Self
pub fn at(self, path: impl Into<RoutePath>) -> Self
The same method on the activation mounted at path — the dotted
route from the service to it, e.g. "tickets.inputs" for the
inputs child of tickets. A path equal to the namespace, or empty,
is the top-level reference itself (so at never makes two equal
methods compare unequal).
Sourcepub fn namespace(&self) -> &str
pub fn namespace(&self) -> &str
The activation namespace, e.g. "tickets" (a child’s own, e.g.
"inputs").
NEST-14 (0.11): &str, no longer &'static str — a Self::named
one is known only at run time.