diff options
| author | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-12-08 18:39:35 -0600 |
| commit | 70e2dfed16da8d5130460ea15b47701e622f4a9f (patch) | |
| tree | 41f670baf3a05ed180880ec2a11d8e5f6a1a1599 /azalea/src/swarm | |
| parent | f2076daba5cfcce81399b075ba9258fbdc2012fa (diff) | |
| download | azalea-drasl-70e2dfed16da8d5130460ea15b47701e622f4a9f.tar.xz | |
wrap_comments = true
Diffstat (limited to 'azalea/src/swarm')
| -rw-r--r-- | azalea/src/swarm/chat.rs | 3 | ||||
| -rw-r--r-- | azalea/src/swarm/mod.rs | 10 | ||||
| -rw-r--r-- | azalea/src/swarm/plugins.rs | 3 |
3 files changed, 10 insertions, 6 deletions
diff --git a/azalea/src/swarm/chat.rs b/azalea/src/swarm/chat.rs index a39632f5..6c51ba33 100644 --- a/azalea/src/swarm/chat.rs +++ b/azalea/src/swarm/chat.rs @@ -111,7 +111,8 @@ impl SwarmState { where S: Send + Sync + Clone + 'static, { - // it should never be locked unless we reused the same plugin for two swarms (bad) + // it should never be locked unless we reused the same plugin for two swarms + // (bad) let mut rx = self.rx.lock().await; while let Some(m) = rx.recv().await { swarm.swarm_tx.send(SwarmEvent::Chat(m)).unwrap(); diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 4956adde..6fc3e40c 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -18,8 +18,8 @@ use std::{future::Future, net::SocketAddr, sync::Arc, time::Duration}; use thiserror::Error; use tokio::sync::mpsc::{self, UnboundedSender}; -/// A helper macro that generates a [`SwarmPlugins`] struct from a list of objects -/// that implement [`SwarmPlugin`]. +/// A helper macro that generates a [`SwarmPlugins`] struct from a list of +/// objects that implement [`SwarmPlugin`]. /// /// ```rust,no_run /// swarm_plugins![azalea_pathfinder::Plugin]; @@ -111,7 +111,8 @@ where pub swarm_state: SS, /// The function that's called every time a bot receives an [`Event`]. pub handle: HandleFn<Fut, S>, - /// The function that's called every time the swarm receives a [`SwarmEvent`]. + /// The function that's called every time the swarm receives a + /// [`SwarmEvent`]. pub swarm_handle: SwarmHandleFn<SwarmFut, S, SS>, /// How long we should wait between each bot joining the server. Set to @@ -342,7 +343,8 @@ impl<S> Swarm<S> where S: Send + Sync + Clone + 'static, { - /// Add a new account to the swarm. You can remove it later by calling [`Client::disconnect`]. + /// Add a new account to the swarm. You can remove it later by calling + /// [`Client::disconnect`]. pub async fn add(&mut self, account: &Account, state: S) -> Result<Client, JoinError> { let conn = Connection::new(&self.resolved_address).await?; let (conn, game_profile) = Client::handshake(conn, account, &self.address.clone()).await?; diff --git a/azalea/src/swarm/plugins.rs b/azalea/src/swarm/plugins.rs index 0c7cf2ae..f92d40e6 100644 --- a/azalea/src/swarm/plugins.rs +++ b/azalea/src/swarm/plugins.rs @@ -13,7 +13,8 @@ type U64Hasher = BuildHasherDefault<NoHashHasher<u64>>; /// A map of plugin ids to [`SwarmPlugin`] trait objects. The client stores /// this so we can keep the state for our [`Swarm`] plugins. /// -/// If you're using azalea, you should generate this from the `swarm_plugins!` macro. +/// If you're using azalea, you should generate this from the `swarm_plugins!` +/// macro. #[derive(Clone, Default)] pub struct SwarmPlugins<S> { map: Option<HashMap<TypeId, Box<dyn SwarmPlugin<S>>, U64Hasher>>, |
