aboutsummaryrefslogtreecommitdiff
path: root/src/framework/standard/create_command.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-09-29 16:13:01 +0200
committeracdenisSK <[email protected]>2017-09-29 16:13:01 +0200
commitd90b90c7f3d8a368acbab46150f199866562229a (patch)
tree42b9a5c2a061ba662fef19277d2711c60b8c6570 /src/framework/standard/create_command.rs
parentFix User::tag and CurrentUser::tag discrim output (diff)
downloadserenity-d90b90c7f3d8a368acbab46150f199866562229a.tar.xz
serenity-d90b90c7f3d8a368acbab46150f199866562229a.zip
Change the way users' command handlers are stored as
Diffstat (limited to 'src/framework/standard/create_command.rs')
-rw-r--r--src/framework/standard/create_command.rs18
1 files changed, 7 insertions, 11 deletions
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<F>(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<F>(mut self, f: F) -> Self
- where F: Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, 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<String, Arc<CommandGroup>>, Args)
+ -> Result<(), CommandError>) -> Self {
+ self.0.exec = CommandType::WithCommands(f);
self
}