Skip to main content

erase_handler_with_state_only

Macro erase_handler_with_state_only 

Source
macro_rules! erase_handler_with_state_only {
    ($handler:expr, $state_ty:ty, $states:expr) => { ... };
}
Expand description

Erase a state-only handler into an ErasedHandler.

The handler must be an async fn(State<Arc<S>>) -> R.

§Example

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

#[allframe_macros::allframe_handler]
async fn db_status(state: State<Arc<AppState>>) -> String { todo!() }

let mut router = Router::new();
let states = router.shared_states();
router.register_erased(
    "db_status",
    erase_handler_with_state_only!(db_status, AppState, states),
);