1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

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
This commit is contained in:
Shayne Hartford 2023-02-27 00:18:02 -05:00 committed by GitHub
parent cbc6af81fb
commit adfbb97af8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -106,6 +106,12 @@ where
self.handler = Some(handler); self.handler = Some(handler);
self 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. /// Add a plugin to the client.
#[must_use] #[must_use]
pub fn add_plugin<T: Plugin>(mut self, plugin: T) -> Self { pub fn add_plugin<T: Plugin>(mut self, plugin: T) -> Self {

View file

@ -199,6 +199,12 @@ where
self.swarm_handler = Some(handler); self.swarm_handler = Some(handler);
self 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. /// Add a plugin to the swarm.
#[must_use] #[must_use]