1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::{Config, Formatter, Tokens};
use std::fmt;
pub trait Custom
where
Self: Sized,
{
type Config: Config;
fn format(
&self,
_out: &mut Formatter,
_config: &mut Self::Config,
_level: usize,
) -> fmt::Result {
Ok(())
}
fn quote_string(out: &mut Formatter, input: &str) -> fmt::Result {
out.write_str(input)
}
fn write_file<'el>(
tokens: Tokens<'el, Self>,
out: &mut Formatter,
config: &mut Self::Config,
level: usize,
) -> fmt::Result {
tokens.format(out, config, level)
}
}
impl Custom for () {
type Config = ();
}