Skip to main content

erase_handler_with_args

Macro erase_handler_with_args 

Source
macro_rules! erase_handler_with_args {
    ($handler:expr, $args_ty:ty) => { ... };
}
Expand description

Erase a handler with typed args into an ErasedHandler.

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

§Example

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

#[allframe_macros::allframe_handler]
async fn get_user(args: GetUserArgs) -> Result<User, MyError> { todo!() }

let mut router = Router::new();
router.register_erased(
    "get_user",
    erase_handler_with_args!(get_user, GetUserArgs),
);