use crate::{DefaultIndentedDisplay, IndentedDisplay, IndentedOptions, Indenter, NullOptions};
impl<'a, O: IndentedOptions<'a>, T: DefaultIndentedDisplay> IndentedDisplay<'a, O> for T {
fn indent(&self, ind: &mut Indenter<'a, O>) -> std::fmt::Result {
use std::fmt::Write;
write!(ind, "{}", self)
}
}
impl DefaultIndentedDisplay for u8 {}
impl DefaultIndentedDisplay for u16 {}
impl DefaultIndentedDisplay for u32 {}
impl DefaultIndentedDisplay for u64 {}
impl DefaultIndentedDisplay for u128 {}
impl DefaultIndentedDisplay for usize {}
impl DefaultIndentedDisplay for i8 {}
impl DefaultIndentedDisplay for i16 {}
impl DefaultIndentedDisplay for i32 {}
impl DefaultIndentedDisplay for i64 {}
impl DefaultIndentedDisplay for i128 {}
impl DefaultIndentedDisplay for isize {}
impl DefaultIndentedDisplay for &str {}
impl DefaultIndentedDisplay for String {}
impl<'a, Opt: IndentedOptions<'a>, T: IndentedDisplay<'a, Opt>> IndentedDisplay<'a, Opt> for [T] {
fn indent(&self, f: &mut Indenter<'a, Opt>) -> std::fmt::Result {
use std::fmt::Write;
write!(f, "[\n")?;
{
let mut sub = f.sub();
for x in self.iter() {
x.indent(&mut sub)?;
write!(sub, ",\n")?;
}
}
write!(f, "]\n")
}
}
impl IndentedOptions<'_> for NullOptions {}