aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-18 20:28:14 -0700
committerZeyla Hellyer <[email protected]>2017-09-18 20:28:14 -0700
commit50d7f00f1b01f4e0d9c86dbdd05a4d4f7b41f8b1 (patch)
tree353e42d9be0b4fd4bd86141490109970c32dd651 /src/framework
parentFix block on spawning multiple shards (diff)
downloadserenity-50d7f00f1b01f4e0d9c86dbdd05a4d4f7b41f8b1.tar.xz
serenity-50d7f00f1b01f4e0d9c86dbdd05a4d4f7b41f8b1.zip
Add Send/Sync to framework items
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/standard/buckets.rs2
-rw-r--r--src/framework/standard/command.rs14
-rw-r--r--src/framework/standard/create_command.rs2
-rw-r--r--src/framework/standard/mod.rs14
4 files changed, 17 insertions, 15 deletions
diff --git a/src/framework/standard/buckets.rs b/src/framework/standard/buckets.rs
index 4719b85..8005a51 100644
--- a/src/framework/standard/buckets.rs
+++ b/src/framework/standard/buckets.rs
@@ -5,7 +5,7 @@ use client::Context;
use model::{ChannelId, GuildId, UserId};
#[cfg(feature = "cache")]
-type Check = Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + 'static;
+type Check = Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + Send + Sync + 'static;
#[cfg(not(feature = "cache"))]
type Check = Fn(&mut Context, ChannelId, UserId) -> bool + 'static;
diff --git a/src/framework/standard/command.rs b/src/framework/standard/command.rs
index e9bdd52..66b6490 100644
--- a/src/framework/standard/command.rs
+++ b/src/framework/standard/command.rs
@@ -4,15 +4,15 @@ use client::Context;
use model::{Message, Permissions};
use std::collections::HashMap;
-pub type Check = Fn(&mut Context, &Message, &mut Args, &Arc<Command>) -> bool + 'static;
-pub type Exec = Fn(&mut Context, &Message, Args) -> Result<(), String> + 'static;
+pub type Check = Fn(&mut Context, &Message, &mut Args, &Arc<Command>) -> bool + Send + Sync + 'static;
+pub type Exec = Fn(&mut Context, &Message, Args) -> Result<(), String> + Send + Sync + 'static;
pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Args)
-> Result<(), String>
- + 'static;
-pub type BeforeHook = Fn(&mut Context, &Message, &str) -> bool + 'static;
-pub type AfterHook = Fn(&mut Context, &Message, &str, Result<(), String>) + 'static;
+ + Send + Sync + 'static;
+pub type BeforeHook = Fn(&mut Context, &Message, &str) -> bool + Send + Sync + 'static;
+pub type AfterHook = Fn(&mut Context, &Message, &str, Result<(), String>) + Send + Sync + 'static;
pub(crate) type InternalCommand = Arc<Command>;
-pub type PrefixCheck = Fn(&mut Context, &Message) -> Option<String> + 'static;
+pub type PrefixCheck = Fn(&mut Context, &Message) -> Option<String> + Send + Sync + 'static;
pub enum CommandOrAlias {
Alias(String),
@@ -76,7 +76,7 @@ pub struct Command {
impl Command {
pub fn new<F>(f: F) -> Self
- where F: Fn(&mut Context, &Message, Args) -> Result<(), String> + 'static {
+ where F: Fn(&mut Context, &Message, Args) -> Result<(), String> + Send + Sync + 'static {
Command {
aliases: Vec::new(),
checks: Vec::default(),
diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs
index a8421e6..b6e8fda 100644
--- a/src/framework/standard/create_command.rs
+++ b/src/framework/standard/create_command.rs
@@ -117,6 +117,8 @@ impl CreateCommand {
pub fn exec_help<F>(mut self, f: F) -> Self
where F: Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Args)
-> Result<(), String>
+ + Send
+ + Sync
+ 'static {
self.0.exec = CommandType::WithCommands(Box::new(f));
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs
index 4e145e0..8a00691 100644
--- a/src/framework/standard/mod.rs
+++ b/src/framework/standard/mod.rs
@@ -139,7 +139,7 @@ pub enum DispatchError {
WebhookAuthor,
}
-type DispatchErrorHook = Fn(Context, Message, DispatchError) + 'static;
+type DispatchErrorHook = Fn(Context, Message, DispatchError) + Send + Sync + 'static;
/// A utility for easily managing dispatches to commands.
///
@@ -290,7 +290,7 @@ impl StandardFramework {
limit: i32,
check: Check)
-> Self
- where Check: Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + 'static,
+ where Check: Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + Send + Sync + 'static,
S: Into<String> {
self.buckets.insert(
s.into(),
@@ -341,7 +341,7 @@ impl StandardFramework {
limit: i32,
check: Check)
-> Self
- where Check: Fn(&mut Context, ChannelId, UserId) -> bool + 'static, S: Into<String> {
+ where Check: Fn(&mut Context, ChannelId, UserId) -> bool + Send + Sync + 'static, S: Into<String> {
self.buckets.insert(
s.into(),
Bucket {
@@ -594,7 +594,7 @@ impl StandardFramework {
/// # }
/// ```
pub fn on<F, S>(mut self, command_name: S, f: F) -> Self
- where F: Fn(&mut Context, &Message, Args) -> Result<(), String> + 'static, S: Into<String> {
+ where F: Fn(&mut Context, &Message, Args) -> Result<(), String> + Send + Sync + 'static, S: Into<String> {
{
let ungrouped = self.groups
.entry("Ungrouped".to_owned())
@@ -731,7 +731,7 @@ impl StandardFramework {
/// }));
/// ```
pub fn on_dispatch_error<F>(mut self, f: F) -> Self
- where F: Fn(Context, Message, DispatchError) + 'static {
+ where F: Fn(Context, Message, DispatchError) + Send + Sync + 'static {
self.dispatch_error_handler = Some(Arc::new(f));
self
@@ -787,7 +787,7 @@ impl StandardFramework {
/// ```
///
pub fn before<F>(mut self, f: F) -> Self
- where F: Fn(&mut Context, &Message, &str) -> bool + 'static {
+ where F: Fn(&mut Context, &Message, &str) -> bool + Send + Sync + 'static {
self.before = Some(Arc::new(f));
self
@@ -818,7 +818,7 @@ impl StandardFramework {
/// }));
/// ```
pub fn after<F>(mut self, f: F) -> Self
- where F: Fn(&mut Context, &Message, &str, Result<(), String>) + 'static {
+ where F: Fn(&mut Context, &Message, &str, Result<(), String>) + Send + Sync + 'static {
self.after = Some(Arc::new(f));
self