matthewdown/command/
macros.rs

1use super::*;
2
3macro_rules! impl_trivial_command
4{
5    ($cmd_type:ty, $walk_type:expr, $name:expr) =>
6    {
7        pub struct Command;
8        impl $crate::command::Command<$cmd_type> for Command
9        {
10            type Positional = $crate::command::NoPositional;
11            type Named      = $crate::command::NoNamed;
12
13            fn create<'a>(&self, _: Self::Positional, _: Self::Named)
14                -> Result<<$cmd_type as $crate::command::Boxed<'a>>::Boxed>
15            {
16                Ok(Box::new($walk_type))
17            }
18
19            fn name(&self) -> &'static str { $name }
20        }
21    }
22}
23
24pub(crate) use impl_trivial_command;