pub struct Flag { /* private fields */ }
Implementations§
Source§impl Flag
impl Flag
Sourcepub fn new(id: String, shorthands: Vec<String>, has_arguments: bool) -> Self
pub fn new(id: String, shorthands: Vec<String>, has_arguments: bool) -> Self
Creates a new flag that can be used in the system for providing data
Examples found in repository?
examples/flag_values.rs (lines 22-26)
12fn main() {
13
14 let command = Command::new(
15 "Test".to_string(),
16 "test command".to_string(),
17 "normal usage".to_string(),
18 executor,
19 "test".to_string()
20 );
21
22 let flag = Flag::new(
23 "testFlag".to_string(),
24 vec!["tf".to_string()],
25 true
26 );
27
28
29 let mut runner = Runner::new();
30 runner.enable_command_handler(CommandHandlerArguments {
31 commands: vec![command],
32 default_no_argument_callback: None,
33 flags: vec![flag]
34 });
35 runner.run();
36}
More examples
examples/flags.rs (lines 22-26)
12fn main() {
13
14 let command = Command::new(
15 "Test".to_string(),
16 "test command".to_string(),
17 "normal usage".to_string(),
18 executor,
19 "test".to_string()
20 );
21
22 let flag = Flag::new(
23 "testFlag".to_string(),
24 vec!["tf".to_string()],
25 false
26 );
27
28
29 let mut runner = Runner::new();
30 runner.enable_command_handler(CommandHandlerArguments {
31 commands: vec![command],
32 default_no_argument_callback: None,
33 flags: vec![flag]
34 });
35 runner.run();
36}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Flag
impl RefUnwindSafe for Flag
impl Send for Flag
impl Sync for Flag
impl Unpin for Flag
impl UnwindSafe for Flag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more