2021-08-31 15:01:46 +00:00
|
|
|
use crate::services::user::{UserSession, UserSessionConfig};
|
2021-07-10 08:27:20 +00:00
|
|
|
|
|
|
|
pub struct UserSessionBuilder {
|
|
|
|
config: Option<UserSessionConfig>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl UserSessionBuilder {
|
|
|
|
pub fn new() -> Self { Self { config: None } }
|
|
|
|
|
|
|
|
pub fn root_dir(mut self, dir: &str) -> Self {
|
|
|
|
self.config = Some(UserSessionConfig::new(dir));
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2021-08-31 15:01:46 +00:00
|
|
|
pub fn build(mut self) -> UserSession {
|
2021-07-10 08:27:20 +00:00
|
|
|
let config = self.config.take().unwrap();
|
2021-07-14 13:12:52 +00:00
|
|
|
|
2021-08-31 15:01:46 +00:00
|
|
|
UserSession::new(config)
|
2021-07-10 08:27:20 +00:00
|
|
|
}
|
|
|
|
}
|