From d90b90c7f3d8a368acbab46150f199866562229a Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Fri, 29 Sep 2017 16:13:01 +0200 Subject: Change the way users' command handlers are stored as --- src/framework/standard/create_command.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/framework/standard/create_command.rs') diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index 423d982..99798ca 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -106,9 +106,8 @@ impl CreateCommand { /// See [`exec_str`] if you _only_ need to return a string on command use. /// /// [`exec_str`]: #method.exec_str - pub fn exec(mut self, func: F) -> Self - where F: Fn(&mut Context, &Message, Args) -> Result<(), CommandError> + Send + Sync + 'static { - self.0.exec = CommandType::Basic(Box::new(func)); + pub fn exec(mut self, func: fn(&mut Context, &Message, Args) -> Result<(), CommandError>) -> Self { + self.0.exec = CommandType::Basic(func); self } @@ -117,14 +116,11 @@ impl CreateCommand { /// the internal HashMap of commands, used specifically for creating a help /// command. /// - /// You can return `Err(Custom(string))` if there's an error. - pub fn exec_help(mut self, f: F) -> Self - where F: Fn(&mut Context, &Message, HashMap>, Args) - -> Result<(), CommandError> - + Send - + Sync - + 'static { - self.0.exec = CommandType::WithCommands(Box::new(f)); + /// You can return `Err(From::from(string))` if there's an error. + pub fn exec_help(mut self, f: + fn(&mut Context, &Message, HashMap>, Args) + -> Result<(), CommandError>) -> Self { + self.0.exec = CommandType::WithCommands(f); self } -- cgit v1.2.3