dejavu_runtime/traits/
mod.rs

1use alloc::string::String;
2use core::fmt::Write;
3
4pub trait Template {
5    const EXTENSION: &'static str;
6    const MIME_TYPE: &'static str;
7    const SIZE_HINT: usize;
8
9    fn write_fmt<W>(&self, w: &mut W) -> core::fmt::Result
10    where
11        W: Write + ?Sized;
12
13    fn render(&self) -> String {
14        let mut out = String::with_capacity(Self::SIZE_HINT);
15        self.write_fmt(&mut out).unwrap();
16        out
17    }
18}