aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-11-03 21:34:51 -0700
committerZeyla Hellyer <[email protected]>2017-11-03 21:36:12 -0700
commit12317b98a0cc145e717e9da3cdbe8bc1ff8fc4f1 (patch)
tree89ada801159493f78efa039eeeab4d90b5997dc3
parent`deserialize_i32` -> `deserialize_u8` (diff)
downloadserenity-12317b98a0cc145e717e9da3cdbe8bc1ff8fc4f1.tar.xz
serenity-12317b98a0cc145e717e9da3cdbe8bc1ff8fc4f1.zip
Fix Client's framework set
The Client would create two Arc's containing unique instances of a user's given Framework, one given to the ShardManager and one kept on the Client. This would result in the user's Framework on the Client being set, but the other left untouched and permanently staying empty.
-rw-r--r--src/client/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 2a97c91..16e61fa 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -322,9 +322,9 @@ impl Client {
);
Client {
- framework: Arc::new(Mutex::new(None)),
token: locked,
ws_uri: url,
+ framework,
data,
shard_manager,
shard_manager_worker,
@@ -453,7 +453,7 @@ impl Client {
/// [framework docs]: ../framework/index.html
#[cfg(feature = "framework")]
pub fn with_framework<F: Framework + Send + 'static>(&mut self, f: F) {
- self.framework = Arc::new(Mutex::new(Some(Box::new(f))));
+ *self.framework.lock() = Some(Box::new(f));
}
/// Establish the connection and start listening for events.