blob: 3dc7f83cf6faa34dfe5ab978e8922d7fe841c152 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//! Example Implicit Dispatcher
//!
//! > This example demonstrates how to use the implicit `dispatcher!` definition syntax enabled by `extra_macros`
use mingling::prelude::*;
// When using implicit syntax, the entry and dispatcher names will be automatically derived
dispatcher!("remote.add" /*, CMDRemoteAdd => EntryRemoteAdd */);
dispatcher!("remote.remove", CMDRemoteRemove => EntryRemoteRemove);
fn main() {
let mut program = ThisProgram::new();
// --------- IMPORTANT ---------
program.with_dispatcher(CMDRemoteAdd);
// ^^^^^^^^^^^^\_ CMDRemoteAdd is implicitly created
// --------- IMPORTANT ---------
program.with_dispatcher(CMDRemoteRemove);
program.exec_and_exit();
}
gen_program!();
|