summaryrefslogtreecommitdiff
path: root/src/works/mod.rs
blob: 3dfd4a2bc0d682a5a35c5975f67e14ccc80d82c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use serde::Deserialize;

pub mod stories;

pub trait Works: for<'a> Deserialize<'a> {
    fn new_from_file(file: std::fs::File) -> Self {
        match serde_json::from_reader(std::io::BufReader::new(file)) {
            Ok(work) => work,
            Err(err) => panic!("Trying to create work from JSON File - {:?}", err),
        }
    }

    fn create_tera_context(&self) -> tera::Context;
}