Skip to main content

erase_handler

Macro erase_handler 

Source
macro_rules! erase_handler {
    ($handler:expr) => { ... };
}
Expand description

Erase a no-args handler into an ErasedHandler.

The handler must be an async fn() -> R where R: IntoHandlerResult.

§Example

use allframe_core::{erase_handler, router::Router};

#[allframe_macros::allframe_handler]
async fn health() -> String { "ok".into() }

let mut router = Router::new();
router.register_erased("health", erase_handler!(health));