pub struct ServerState {
config: Arc<RwLock<ServerConfig>>,
running: Arc<RwLock<bool>>,
}
Expand description
Main server state
Fields§
§config: Arc<RwLock<ServerConfig>>
Server configuration
running: Arc<RwLock<bool>>
Running status
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn new(config: ServerConfig) -> Self
pub fn new(config: ServerConfig) -> Self
Create a new server state
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check if server is running
Sourcepub async fn set_running(&self, running: bool)
pub async fn set_running(&self, running: bool)
Set server running status
Sourcepub async fn get_config(&self) -> ServerConfig
pub async fn get_config(&self) -> ServerConfig
Get server configuration
Sourcepub async fn update_config(&self, config: ServerConfig)
pub async fn update_config(&self, config: ServerConfig)
Update server configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl !UnwindSafe for ServerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more