notification!() { /* proc-macro */ }Expand description
notification!() macro for declaration of RPC notification handlers
This macro simplifies creation of async notification handler closures supplied to the RPC notification interface. An async notification closure requires to be Boxed and its result must be Pinned, resulting in the following syntax:
ⓘ
interface.notification(Box::new(Notification::new(|msg: MyMsg|
Box::pin(
async move {
// ...
Ok(())
}
)
)))
The notification macro adds the required Box and Pin syntax, simplifying the declaration as follows:
ⓘ
interface.notification(notification!(|msg: MyMsg| async move {
// ...
Ok(())
}))Constructs a client-side workflow_rpc::client::Notification handler from
a closure or expression, wrapping its body so it can be registered to receive
server-initiated notifications.