Macro dequeue_with_timeout

Source
macro_rules! dequeue_with_timeout {
    ($receiver:expr, $pattern:path) => { ... };
    ($receiver:expr, $pattern:path, $timeout_duration:expr) => { ... };
}
Expand description

Macro to await a channel Receiver<pb::KaspadMessage>::recv call with a default/specified timeout and expect a specific payload type. Usage:

let res = dequeue_with_timeout!(receiver, Payload::Verack) // Uses the default timeout
// or:
let res = dequeue_with_timeout!(receiver, Payload::Verack, Duration::from_secs(30))