Skip to main content

erase_streaming_handler_with_args

Macro erase_streaming_handler_with_args 

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

Erase a streaming handler with typed args into an ErasedStreamHandler.

The handler must be an async fn(T, StreamSender) -> R.

§Example

use allframe_core::{erase_streaming_handler_with_args, router::{Router, StreamSender}};

#[allframe_macros::allframe_handler(streaming)]
async fn stream_user(args: GetUserArgs, tx: StreamSender) -> String { "done".into() }

let mut router = Router::new();
router.register_streaming_erased(
    "stream_user",
    erase_streaming_handler_with_args!(stream_user, GetUserArgs),
);