Skip to main content

tex_engine/engine/utils/
outputs.rs

1use std::fmt::Display;
2
3pub trait Outputs {
4    fn new() -> Self;
5
6    fn message<D: Display>(&self, text: D) {
7        log::info!(target:"message","{}",text);
8    }
9
10    fn file_open<D: Display>(&self, text: D) {
11        log::info!(target:"file","({}",text);
12    }
13
14    fn file_close<D: Display>(&self, _text: D) {
15        log::info!(target:"file",")");
16    }
17
18    fn write_18<D: Display>(&self, text: D) {
19        log::info!(target:"write::18","{}",text);
20    }
21
22    fn write_17<D: Display>(&self, text: D) {
23        log::info!(target:"write::17","{}",text);
24    }
25
26    fn write_16<D: Display>(&self, text: D) {
27        log::info!(target:"write::16","{}",text);
28    }
29
30    fn write_neg1<D: Display>(&self, text: D) {
31        log::info!(target:"write::-1","{}",text);
32    }
33
34    fn write_other<D: Display>(&self, text: D) {
35        log::info!(target:"write::?","{}",text);
36    }
37}
38
39pub struct LogOutputs;
40impl Outputs for LogOutputs {
41    fn new() -> Self {
42        Self
43    }
44}