From 30cbeecdfea4199b8f134c8394c677588ff9a2ce Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 23 Dec 2024 13:10:30 +0000 Subject: [PATCH] update outdated doc in Swarm and remove unnecessary generics --- azalea/src/swarm/mod.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 18bde3f15..5ae8f9a14 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -1,4 +1,6 @@ //! Swarms are a way to conveniently control many bots. +//! +//! See [`Swarm`] for more information. mod chat; mod events; @@ -26,8 +28,8 @@ use crate::{BoxHandleFn, DefaultBotPlugins, HandleFn, JoinOpts, NoState, StartEr /// /// Swarms are created from [`SwarmBuilder`]. /// -/// The `S` type parameter is the type of the state for individual bots. -/// It's used to make the [`Swarm::add`] function work. +/// Clients can be added to the swarm later via [`Swarm::add`], and can be +/// removed with [`Client::disconnect`]. #[derive(Clone, Resource)] pub struct Swarm { pub ecs_lock: Arc>, @@ -131,7 +133,7 @@ impl SwarmBuilder { } } -impl SwarmBuilder +impl SwarmBuilder where SS: Default + Send + Sync + Clone + Resource + 'static, { @@ -162,9 +164,9 @@ where /// # } /// ``` #[must_use] - pub fn set_handler(self, handler: HandleFn) -> SwarmBuilder + pub fn set_handler(self, handler: HandleFn) -> SwarmBuilder where - Fut: Future + Send + 'static, + Fut: Future + Send + 'static, S: Send + Sync + Clone + Component + Default + 'static, { SwarmBuilder { @@ -179,7 +181,7 @@ where } } -impl SwarmBuilder +impl SwarmBuilder where S: Send + Sync + Clone + Component + 'static, { @@ -211,13 +213,13 @@ where /// } /// ``` #[must_use] - pub fn set_swarm_handler( + pub fn set_swarm_handler( self, handler: SwarmHandleFn, - ) -> SwarmBuilder + ) -> SwarmBuilder where SS: Default + Send + Sync + Clone + Resource + 'static, - Fut: Future + Send + 'static, + Fut: Future + Send + 'static, { SwarmBuilder { handler: self.handler,