aboutsummaryrefslogtreecommitdiff
path: root/src/framework/standard/command.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-11-20 14:55:32 +0100
committeracdenisSK <[email protected]>2017-11-20 14:55:32 +0100
commit0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca (patch)
treea9e9243c873eadc2ae4a8c7a4733830814bf2c08 /src/framework/standard/command.rs
parentAdd guild invite to readme (diff)
downloadserenity-0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca.tar.xz
serenity-0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca.zip
Add an impl for `Fn(&mut Context, &Message, Args)`
Diffstat (limited to 'src/framework/standard/command.rs')
-rw-r--r--src/framework/standard/command.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/framework/standard/command.rs b/src/framework/standard/command.rs
index 8cf4fc5..6b90479 100644
--- a/src/framework/standard/command.rs
+++ b/src/framework/standard/command.rs
@@ -137,11 +137,13 @@ impl Command for Box<Command> {
}
}
-pub(crate) struct A(pub fn(&mut Context, &Message, Args) -> Result<(), Error>);
-
-impl Command for A {
+impl<F> Command for F where F: Fn(&mut Context, &Message, Args) -> Result<(), Error>
+ + Send
+ + Sync
+ + ?Sized
+ + 'static {
fn execute(&self, c: &mut Context, m: &Message, a: Args) -> Result<(), Error> {
- (self.0)(c, m, a)
+ (*self)(c, m, a)
}
}