indent_display/
defaults.rs1use crate::{DefaultIndentedDisplay, IndentedDisplay, IndentedOptions, Indenter, NullOptions};
21
22impl<'a, O: IndentedOptions<'a>, T: DefaultIndentedDisplay> IndentedDisplay<'a, O> for T {
25 fn indent(&self, ind: &mut Indenter<'a, O>) -> std::fmt::Result {
26 use std::fmt::Write;
27 write!(ind, "{}", self)
28 }
29}
30
31impl DefaultIndentedDisplay for u8 {}
33impl DefaultIndentedDisplay for u16 {}
34impl DefaultIndentedDisplay for u32 {}
35impl DefaultIndentedDisplay for u64 {}
36impl DefaultIndentedDisplay for u128 {}
37impl DefaultIndentedDisplay for usize {}
38impl DefaultIndentedDisplay for i8 {}
39impl DefaultIndentedDisplay for i16 {}
40impl DefaultIndentedDisplay for i32 {}
41impl DefaultIndentedDisplay for i64 {}
42impl DefaultIndentedDisplay for i128 {}
43impl DefaultIndentedDisplay for isize {}
44impl DefaultIndentedDisplay for &str {}
45impl DefaultIndentedDisplay for String {}
46impl<'a, Opt: IndentedOptions<'a>, T: IndentedDisplay<'a, Opt>> IndentedDisplay<'a, Opt> for [T] {
47 fn indent(&self, f: &mut Indenter<'a, Opt>) -> std::fmt::Result {
50 use std::fmt::Write;
51 write!(f, "[\n")?;
52 {
53 let mut sub = f.sub();
54 for x in self.iter() {
55 x.indent(&mut sub)?;
56 write!(sub, ",\n")?;
57 }
58 }
59 write!(f, "]\n")
60 }
61}
62
63impl IndentedOptions<'_> for NullOptions {}