From 70e2dfed16da8d5130460ea15b47701e622f4a9f Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 8 Dec 2022 18:39:35 -0600 Subject: wrap_comments = true --- azalea/src/pathfinder/moves.rs | 3 ++- azalea/src/pathfinder/mtdstarlite.rs | 9 ++++++--- azalea/src/prelude.rs | 3 ++- azalea/src/start.rs | 4 ++-- azalea/src/swarm/chat.rs | 3 ++- azalea/src/swarm/mod.rs | 10 ++++++---- azalea/src/swarm/plugins.rs | 3 ++- 7 files changed, 22 insertions(+), 13 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/pathfinder/moves.rs b/azalea/src/pathfinder/moves.rs index 63e24412..ac2137d3 100644 --- a/azalea/src/pathfinder/moves.rs +++ b/azalea/src/pathfinder/moves.rs @@ -38,7 +38,8 @@ const WALK_ONE_BLOCK_COST: f32 = 1.0; pub trait Move { fn cost(&self, world: &World, node: &Node) -> f32; - /// Returns by how much the entity's position should be changed when this move is executed. + /// Returns by how much the entity's position should be changed when this + /// move is executed. fn offset(&self) -> BlockPos; fn next_node(&self, node: &Node) -> Node { Node { diff --git a/azalea/src/pathfinder/mtdstarlite.rs b/azalea/src/pathfinder/mtdstarlite.rs index ff0fe4cc..50a467df 100644 --- a/azalea/src/pathfinder/mtdstarlite.rs +++ b/azalea/src/pathfinder/mtdstarlite.rs @@ -20,7 +20,8 @@ pub struct MTDStarLite< PredecessorsFn: Fn(&N) -> Vec>, SuccessFn: Fn(&N) -> bool, > { - /// Returns a rough estimate of how close we are to the goal. Lower = closer. + /// Returns a rough estimate of how close we are to the goal. Lower = + /// closer. pub heuristic: HeuristicFn, /// Returns the nodes that can be reached from the given node. pub successors: SuccessorsFn, @@ -29,7 +30,8 @@ pub struct MTDStarLite< /// can be the same as `successors`. pub predecessors: PredecessorsFn, /// Returns true if the given node is at the goal. - /// A simple implementation is to check if the given node is equal to the goal. + /// A simple implementation is to check if the given node is equal to the + /// goal. pub success: SuccessFn, start: N, @@ -43,7 +45,8 @@ pub struct MTDStarLite< node_states: HashMap>, updated_edge_costs: Vec>, - /// This only exists so it can be referenced by `state()` when there's no state. + /// This only exists so it can be referenced by `state()` when there's no + /// state. default_state: NodeState, } diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs index 30205e59..bedf724f 100644 --- a/azalea/src/prelude.rs +++ b/azalea/src/prelude.rs @@ -1,4 +1,5 @@ -//! The Azalea prelude. Things that are necessary for a bare-bones bot are re-exported here. +//! The Azalea prelude. Things that are necessary for a bare-bones bot are +//! re-exported here. pub use crate::bot::BotTrait; pub use crate::pathfinder::Trait; diff --git a/azalea/src/start.rs b/azalea/src/start.rs index c7d79261..e2374fb8 100644 --- a/azalea/src/start.rs +++ b/azalea/src/start.rs @@ -86,8 +86,8 @@ pub enum StartError { Join(#[from] azalea_client::JoinError), } -/// Join a server and start handling events. This function will run forever until -/// it gets disconnected from the server. +/// Join a server and start handling events. This function will run forever +/// until it gets disconnected from the server. /// /// # Examples /// 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, - /// 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, /// How long we should wait between each bot joining the server. Set to @@ -342,7 +343,8 @@ impl Swarm 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 { 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>; /// 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 { map: Option>, U64Hasher>>, -- cgit v1.2.3