Skip to main content

dispatch

Macro dispatch 

Source
macro_rules! dispatch {
    ($client:expr, $update:expr, $( $pattern:tt )+ ) => { ... };
}
Expand description

Route a crate::update::Update to the first matching arm.

ยงSyntax

dispatch!(client, update,
VariantName(binding) [if guard] => { body },
...
[_ => { fallback }]
);
  • client : a ferogram::Client (available inside every arm body)
  • update : the Update value to dispatch
  • Each arm mirrors a variant of crate::update::Update
  • Guards (if expr) are optional
  • A catch-all _ => {} arm is optional but recommended to avoid warnings