Skip to main content

with_api

Macro with_api 

Source
macro_rules! with_api {
    ($m:ident, $TokenStream: path, $Span: path, $Symbol: path) => { ... };
}
🔬This is a nightly-only experimental API. (proc_macro_internals)
Expand description

Higher-order macro describing the server RPC API, allowing automatic generation of type-safe Rust APIs, both client-side and server-side.

with_api!(my_macro, MyTokenStream, MySpan, MySymbol) expands to:

my_macro! {
    fn ts_clone(stream: &MyTokenStream) -> MyTokenStream;
    fn span_debug(span: &MySpan) -> String;
    // ...
}

The second (TokenStream), third (Span) and fourth (Symbol) argument serve to customize the argument/return types that need special handling, to enable several different representations of these types.