summaryrefslogtreecommitdiff
path: root/src/works/mod.rs
blob: f399fdd883a2bdec851fa802c193dd9a75ed8447 (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) -> Vec<tera::Context>;
}