borsa_router_method

Macro borsa_router_method 

Source
macro_rules! borsa_router_method {
    (
        $(#[$meta:meta])*
        method: $name:ident( $inst_ident:ident : $inst_ty:ty $(, $arg_ident:ident : $arg_ty:ty )* ) -> $ret:ty,
        provider: $provider:ident,
        accessor: $accessor:ident,
        capability: $capability:expr,
        not_found: $not_found:expr,
        call: $call_name:ident( $call_first:ident $(, $call_rest:ident )* )
        $(, post_ok: $post_ok:expr )?
    ) => { ... };
}
Expand description

Generate a router async method that selects providers, applies kind filters, and calls a single-provider method. Handles not-found fallbacks via orchestrator.

Optional post_ok hook can transform a successful provider response into an error (e.g., enforcing exchange constraints) to enable fallback or continue races under latency mode.

Notes on not_found label:

  • Pass a noun only (e.g., “quote”, “holders”, “analysis”).
  • The orchestrator formats the final error as “{label} for {SYMBOL}”.
  • Do not include the word “for” in the label.