16 lines
324 B
Rust
16 lines
324 B
Rust
use crate::templates::Templates;
|
|
use crate::Besult;
|
|
use std::sync::Arc;
|
|
|
|
#[derive(Clone)]
|
|
pub struct State {
|
|
pub templates: Arc<Templates>,
|
|
}
|
|
|
|
impl State {
|
|
pub async fn try_new() -> Besult<Self> {
|
|
let templates = Arc::new(Templates::try_load("src/templates").await?);
|
|
|
|
Ok(Self { templates })
|
|
}
|
|
}
|