aboutsummaryrefslogtreecommitdiff
path: root/src/ext/framework
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-04-18 21:21:30 -0700
committerZeyla Hellyer <[email protected]>2017-04-19 14:53:32 -0700
commitff4437addb01e5c6c3ad8c5b1830db0d0a86396b (patch)
tree1aa48b22a111174172b97ee9b41998ac3656c73d /src/ext/framework
parentRemove ChannelPinsAck/MessageAck events (diff)
downloadserenity-ff4437addb01e5c6c3ad8c5b1830db0d0a86396b.tar.xz
serenity-ff4437addb01e5c6c3ad8c5b1830db0d0a86396b.zip
Accept a slice of args in help commands
The help commands don't actually need to have the arguments passed by value, so passing them by reference is fine.
Diffstat (limited to 'src/ext/framework')
-rw-r--r--src/ext/framework/command.rs2
-rw-r--r--src/ext/framework/create_command.rs2
-rw-r--r--src/ext/framework/help_commands.rs4
-rw-r--r--src/ext/framework/mod.rs2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/ext/framework/command.rs b/src/ext/framework/command.rs
index 70ee4ff..76ca416 100644
--- a/src/ext/framework/command.rs
+++ b/src/ext/framework/command.rs
@@ -7,7 +7,7 @@ use std::collections::HashMap;
pub type Check = Fn(&mut Context, &Message) -> bool + Send + Sync + 'static;
pub type Exec = Fn(&mut Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
-pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
+pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, &[String]) -> Result<(), String> + Send + Sync + 'static;
pub type BeforeHook = Fn(&mut Context, &Message, &String) -> bool + Send + Sync + 'static;
pub type AfterHook = Fn(&mut Context, &Message, &String, Result<(), String>) + Send + Sync + 'static;
#[doc(hidden)]
diff --git a/src/ext/framework/create_command.rs b/src/ext/framework/create_command.rs
index 7f2c25f..512e82c 100644
--- a/src/ext/framework/create_command.rs
+++ b/src/ext/framework/create_command.rs
@@ -112,7 +112,7 @@ impl CreateCommand {
///
/// You can return `Err(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>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static {
+ where F: Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, &[String]) -> Result<(), String> + Send + Sync + 'static {
self.0.exec = CommandType::WithCommands(Box::new(f));
self
diff --git a/src/ext/framework/help_commands.rs b/src/ext/framework/help_commands.rs
index cee0e5e..1f38bd5 100644
--- a/src/ext/framework/help_commands.rs
+++ b/src/ext/framework/help_commands.rs
@@ -54,7 +54,7 @@ fn remove_aliases(cmds: &HashMap<String, CommandOrAlias>) -> HashMap<&String, &I
pub fn with_embeds(ctx: &mut Context,
_: &Message,
groups: HashMap<String, Arc<CommandGroup>>,
- args: Vec<String>) -> Result<(), String> {
+ args: &[String]) -> Result<(), String> {
if !args.is_empty() {
let name = args.join(" ");
@@ -179,7 +179,7 @@ pub fn with_embeds(ctx: &mut Context,
pub fn plain(ctx: &mut Context,
_: &Message,
groups: HashMap<String, Arc<CommandGroup>>,
- args: Vec<String>) -> Result<(), String> {
+ args: &[String]) -> Result<(), String> {
if !args.is_empty() {
let name = args.join(" ");
diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs
index 5ff67ec..d0cc179 100644
--- a/src/ext/framework/mod.rs
+++ b/src/ext/framework/mod.rs
@@ -512,7 +512,7 @@ impl Framework {
(x)(&mut context, &message, args)
},
CommandType::WithCommands(ref x) => {
- (x)(&mut context, &message, groups, args)
+ (x)(&mut context, &message, groups, &args)
}
};