macro_rules! parse_prefix_args {
($ctx:expr, $msg:expr, $args:expr, $attachment_index:expr => $(
$( #[$attr:ident] )?
( $($type:tt)* )
),* $(,)? ) => { ... };
}Expand description
Macro for parsing an argument string into multiple parameter types.
An invocation of this macro is generated by the crate::command macro, so you usually don’t need
to use this macro directly.
assert_eq!(
poise::parse_prefix_args!(
&ctx, &msg,
"one two three four", 0 => (String), (Option<u32>), #[rest] (String)
).await.unwrap(),
(
String::from("one"),
None,
String::from("two three four"),
),
);
assert_eq!(
poise::parse_prefix_args!(
&ctx, &msg,
"1 2 3 4", 0 => (String), (Option<u32>), #[rest] (String)
).await.unwrap(),
(
String::from("1"),
Some(2),
String::from("3 4"),
),
);