Add helper function for adding command to Commands
This commit is contained in:
parent
b62afb32e6
commit
ea53af739a
2 changed files with 43 additions and 28 deletions
|
|
@ -153,6 +153,13 @@ pub trait CommandExt: Sized {
|
|||
fn clap(self) -> clap::Clap<Self> {
|
||||
clap::Clap(self)
|
||||
}
|
||||
|
||||
fn add_to<E>(self, commands: &mut Commands<E>)
|
||||
where
|
||||
Self: Command<E> + Send + Sync + 'static,
|
||||
{
|
||||
commands.add(self);
|
||||
}
|
||||
}
|
||||
|
||||
// Sadly this doesn't work: `impl<E, C: Command<E>> CommandExt for C {}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue