diff options
| author | François Triquet <[email protected]> | 2017-10-04 08:41:54 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2017-10-04 08:41:54 +0200 |
| commit | 55167c300598536a852b3596fcf1c420aeb96c3a (patch) | |
| tree | c9ba3233515640f11113f91a51360781344c99d8 /src/framework | |
| parent | Force `I` to be not implemented outside serenity (diff) | |
| download | serenity-55167c300598536a852b3596fcf1c420aeb96c3a.tar.xz serenity-55167c300598536a852b3596fcf1c420aeb96c3a.zip | |
Replace Vec parameters by IntoIterator (#176)
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/standard/configuration.rs | 6 | ||||
| -rw-r--r-- | src/framework/standard/create_command.rs | 6 | ||||
| -rw-r--r-- | src/framework/standard/create_group.rs | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/framework/standard/configuration.rs b/src/framework/standard/configuration.rs index 8112319..8cc25fa 100644 --- a/src/framework/standard/configuration.rs +++ b/src/framework/standard/configuration.rs @@ -352,8 +352,8 @@ impl Configuration { /// client.with_framework(StandardFramework::new().configure(|c| c /// .prefixes(vec!["!", ">", "+"]))); /// ``` - pub fn prefixes(mut self, prefixes: Vec<&str>) -> Self { - self.prefixes = prefixes.iter().map(|x| x.to_string()).collect(); + pub fn prefixes<T: ToString, It: IntoIterator<Item=T>>(mut self, prefixes: It) -> Self { + self.prefixes = prefixes.into_iter().map(|x| x.to_string()).collect(); self } @@ -401,7 +401,7 @@ impl Configuration { /// client.with_framework(StandardFramework::new().configure(|c| c /// .delimiters(vec![", ", " "]))); /// ``` - pub fn delimiters(mut self, delimiters: Vec<&str>) -> Self { + pub fn delimiters<T: ToString, It: IntoIterator<Item=T>>(mut self, delimiters: It) -> Self { self.delimiters.clear(); self.delimiters .extend(delimiters.into_iter().map(|s| s.to_string())); diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index c81c57a..9df9c82 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -9,7 +9,7 @@ pub struct CreateCommand(pub Command); impl CreateCommand { /// Adds multiple aliases. - pub fn batch_known_as(mut self, names: Vec<&str>) -> Self { + pub fn batch_known_as<T: ToString, It: IntoIterator<Item=T>>(mut self, names: It) -> Self { self.0 .aliases .extend(names.into_iter().map(|n| n.to_string())); @@ -212,8 +212,8 @@ impl CreateCommand { } /// Sets roles that are allowed to use the command. - pub fn allowed_roles(mut self, allowed_roles: Vec<&str>) -> Self { - self.0.allowed_roles = allowed_roles.iter().map(|x| x.to_string()).collect(); + pub fn allowed_roles<T: ToString, It: IntoIterator<Item=T>>(mut self, allowed_roles: It) -> Self { + self.0.allowed_roles = allowed_roles.into_iter().map(|x| x.to_string()).collect(); self } diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs index 7b9468d..ee7f2cb 100644 --- a/src/framework/standard/create_group.rs +++ b/src/framework/standard/create_group.rs @@ -139,8 +139,8 @@ impl CreateGroup { } /// Sets roles that are allowed to use the command. - pub fn allowed_roles(mut self, allowed_roles: Vec<&str>) -> Self { - self.0.allowed_roles = allowed_roles.iter().map(|x| x.to_string()).collect(); + pub fn allowed_roles<T: ToString, It: IntoIterator<Item=T>>(mut self, allowed_roles: It) -> Self { + self.0.allowed_roles = allowed_roles.into_iter().map(|x| x.to_string()).collect(); self } |