From 0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Mon, 20 Nov 2017 14:55:32 +0100 Subject: Add an impl for `Fn(&mut Context, &Message, Args)` --- src/framework/standard/command.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/framework/standard/command.rs') 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 { } } -pub(crate) struct A(pub fn(&mut Context, &Message, Args) -> Result<(), Error>); - -impl Command for A { +impl 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) } } -- cgit v1.2.3