indentation/macros/
mod.rs

1
2
3/// A macro to create a `String` from a format string.
4#[macro_export]
5macro_rules! indent_fmt {
6    ($dst:expr, $($arg:tt)*) => {
7        $dst.write_fmt($crate::format_args!($($arg)*))
8    };
9}
10
11/// A macro to write to a `Formatter` from a format string.
12#[macro_export]
13macro_rules! indent_write {
14    ($dst:expr, $($arg:tt)*) => {
15        $dst.write_fmt($crate::format_args!($($arg)*))
16    };
17}
18
19/// A macro to write to a `Formatter` from a format string.
20#[macro_export]
21macro_rules! wrap_display {
22    ($($t:ty),*) => {
23        $(
24            impl core::fmt::Display for $t {
25                fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
26                    IndentFormatter::wrap(self, f)
27                }
28            }
29        )*
30    };
31}