You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
489 B
33 lines
489 B
//! Web server state
|
|
use super::*;
|
|
use tokio::{
|
|
sync::{
|
|
RwLock,
|
|
},
|
|
};
|
|
|
|
#[derive(Debug)]
|
|
pub struct State
|
|
{
|
|
backend: RwLock<ServerState>,
|
|
settings: Settings,
|
|
}
|
|
|
|
impl State
|
|
{
|
|
/// Create state from a backend state and server settings
|
|
pub fn new(backend: ServerState, settings: Settings) -> Self
|
|
{
|
|
Self {
|
|
backend: RwLock::new(backend),
|
|
settings,
|
|
}
|
|
}
|
|
|
|
/// The web server settings
|
|
pub fn cfg(&self) -> &Settings
|
|
{
|
|
&self.settings
|
|
}
|
|
}
|