fedimint_core

Macro __api_endpoint

Source
macro_rules! __api_endpoint {
    (
        $path:expr,
        // Api Version this endpoint was introduced in, at the current consensus level
        // Currently for documentation purposes only.
        $version_introduced:expr,
        async |$state:ident: &$state_ty:ty, $context:ident, $param:ident: $param_ty:ty| -> $resp_ty:ty $body:block
    ) => { ... };
}
Expand description

ยงExample

struct State;

let _: ApiEndpoint<State> = api_endpoint! {
    "/foobar",
    ApiVersion::new(0, 3),
    async |state: &State, _dbtx, params: ()| -> i32 {
        Ok(0)
    }
};