custom/
custom.rs

1//! Example of customized printing format
2use kex::*;
3
4fn main() {
5    use std::io::stdout;
6
7    let config = Config::new(
8        Some(AddressFormatter::new(
9            AddressStyle::Dec(8),
10            Separators::new("", &'\u{1F929}'.to_string()),
11        )),
12        ByteFormatter::new(
13            Default::default(),
14            Groupping::RepeatingGroup(Group::new(4, "#"), 4),
15            "",
16            false,
17            Default::default(),
18        ),
19        Some(CharFormatter::new(
20            ".".to_string(),
21            Separators::new(&'\u{1F4A5}'.to_string(), &'\u{1F4A8}'.to_string()),
22        )),
23        true
24    );
25    let mut printer = Printer::new(stdout(), 0, config);
26
27    let bytes1 = &[222u8, 173, 190, 239];
28    let bytes2 = &[0xfeu8, 0xed, 0xfa];
29    let title = b"Custom printing";
30
31    for _ in 0..10 {
32        _ = printer.push(bytes1);
33    }
34
35    _ = printer.push(title);
36
37    for _ in 0..11 {
38        _ = printer.push(bytes2);
39    }
40
41    printer.finish();
42}