2024-05-14 14:30:03 -05:00
|
|
|
use crate::{prelude::*, templates::Templates};
|
2024-05-14 12:28:27 -05:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct State {
|
|
|
|
pub templates: Arc<Templates>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl State {
|
2024-05-14 14:30:03 -05:00
|
|
|
pub async fn try_new() -> Result<Self> {
|
2024-05-14 12:28:27 -05:00
|
|
|
let templates = Arc::new(Templates::try_load("src/templates").await?);
|
|
|
|
|
|
|
|
Ok(Self { templates })
|
|
|
|
}
|
|
|
|
}
|