tempura 0.5.2

Pipeline-based Static site generator
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Context;

use crate::value::Value;

use super::Loader;

pub struct JsonLoader;

impl Loader for JsonLoader {
    #[tracing::instrument(err, skip_all)]
    fn load(reader: impl std::io::Read) -> anyhow::Result<Value> {
        let json =
            serde_json::from_reader(reader).with_context(|| "Could not parse JSON".to_string())?;

        Ok(Value::JSON(json))
    }
}