From 776f714826882a3fc1bbe3b2cdf46f902dd48742 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 3 Aug 2023 01:29:50 -0500 Subject: loosen Default requirement for State on SwarmBuilder --- azalea/src/swarm/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 13741aa0..1ea4aa02 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -50,7 +50,7 @@ pub struct Swarm { /// Create a new [`Swarm`]. pub struct SwarmBuilder where - S: Default + Send + Sync + Clone + 'static, + S: Send + Sync + Clone + 'static, SS: Default + Send + Sync + Clone + 'static, Fut: Future>, SwarmFut: Future>, @@ -79,7 +79,7 @@ impl SwarmBuilder where Fut: Future> + Send + 'static, SwarmFut: Future> + Send + 'static, - S: Default + Send + Sync + Clone + Component + 'static, + S: Send + Sync + Clone + Component + 'static, SS: Default + Send + Sync + Clone + Resource + 'static, { /// Start creating the swarm. @@ -138,7 +138,10 @@ where /// clients to have different default states, add them one at a time with /// [`Self::add_account_with_state`]. #[must_use] - pub fn add_accounts(mut self, accounts: Vec) -> Self { + pub fn add_accounts(mut self, accounts: Vec) -> Self + where + S: Default, + { for account in accounts { self = self.add_account(account); } @@ -150,7 +153,10 @@ where /// This will make the state for this client be the default, use /// [`Self::add_account_with_state`] to avoid that. #[must_use] - pub fn add_account(self, account: Account) -> Self { + pub fn add_account(self, account: Account) -> Self + where + S: Default, + { self.add_account_with_state(account, S::default()) } /// Add an account with a custom initial state. Use just -- cgit v1.2.3