From adfbb97af815b8e626771a4a96a85d87220a485f Mon Sep 17 00:00:00 2001 From: Shayne Hartford Date: Mon, 27 Feb 2023 00:18:02 -0500 Subject: [PATCH] Add `set_state` and `set_swarm_state` (#76) * Add set_state and set_swarm_state * Add [must_use], Remove set_state, and change state to swarm_state * Forgot the other must_use * I'm not good at this --- azalea/src/lib.rs | 6 ++++++ azalea/src/swarm/mod.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 4e21fbbd..827c3904 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -106,6 +106,12 @@ where self.handler = Some(handler); self } + /// Set the client state instead of initializing defaults. + #[must_use] + pub fn set_state(mut self, state: S) -> Self { + self.state = state; + self + } /// Add a plugin to the client. #[must_use] pub fn add_plugin(mut self, plugin: T) -> Self { diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 9edaa305..c0d9cb56 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -199,6 +199,12 @@ where self.swarm_handler = Some(handler); self } + /// Set the swarm state instead of initializing defaults. + #[must_use] + pub fn set_swarm_state(mut self, swarm_state: SS) -> Self { + self.swarm_state = swarm_state; + self + } /// Add a plugin to the swarm. #[must_use]