Skip to main content

xrpc_methods

Macro xrpc_methods 

Source
macro_rules! xrpc_methods {
    (
        $(#[$methods_meta:meta])*
        $methods:ident,
        $(#[$credentials_meta:meta])*
        $credentials:ident,
        $router:ident,
        { $($nsid:literal => $verb:ident($handler:path) as $credential:ident),* $(,)? }
    ) => { ... };
}
Expand description

The XRPC methods this server serves: for each one, the handler behind it and the credential it accepts.

One list producing three things — the routes themselves, the names of them, and the credential table crate::auth resolves against. That is the whole point of the macro: there is no way to write a .route() call for an XRPC method except by adding an entry here, and an entry with no as <Credential> is a syntax error rather than a route that quietly defaults to open. The three lists cannot drift because there is only one list.

Expands to $methods (the NSIDs, for the conformance harness), $credentials (the NSID → auth::Credential table, which auth::ROUTE_CREDENTIALS is assembled from) and $router (the routes those names stand for).