diff options
| author | acdenisSK <[email protected]> | 2017-09-11 16:03:13 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-09-11 16:03:29 +0200 |
| commit | 97e84fe136c5649ca3529c11790d9988dfe3bb92 (patch) | |
| tree | c37c0e988d6e2495cb3ff56333c1a140a3421e8a /src/client/context.rs | |
| parent | Fixed admin bypass perm to framework allowed_roles (diff) | |
| download | serenity-97e84fe136c5649ca3529c11790d9988dfe3bb92.tar.xz serenity-97e84fe136c5649ca3529c11790d9988dfe3bb92.zip | |
Add `Context::handle`
Diffstat (limited to 'src/client/context.rs')
| -rw-r--r-- | src/client/context.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index 1bd5ed7..3802134 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -3,6 +3,7 @@ use typemap::ShareMap; use gateway::Shard; use model::*; use parking_lot::Mutex; +use tokio_core::reactor::Handle; #[cfg(feature = "cache")] use super::CACHE; @@ -40,14 +41,17 @@ pub struct Context { /// Note that if you are sharding, in relevant terms, this is the shard /// which received the event being dispatched. pub shard: Arc<Mutex<Shard>>, + /// A tokio handle for spawning efficient tasks inside commands and events. + pub handle: Handle, } impl Context { /// Create a new Context to be passed to an event handler. - pub(crate) fn new(shard: Arc<Mutex<Shard>>, data: Arc<Mutex<ShareMap>>) -> Context { + pub(crate) fn new(shard: Arc<Mutex<Shard>>, data: Arc<Mutex<ShareMap>>, handle: Handle) -> Context { Context { data, shard, + handle, } } |