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 {hub}.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.
Implementations§
Source§impl MethodRef
impl MethodRef
pub const fn new(namespace: &'static str, method: &'static str) -> Self
Sourcepub fn at(self, path: &'static str) -> Self
pub fn at(self, path: &'static str) -> Self
The same method on the activation mounted at path — the dotted
route from the hub 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 const fn namespace(&self) -> &'static str
pub const fn namespace(&self) -> &'static str
The activation namespace, e.g. "tickets" (a child’s own, e.g.
"inputs").