asmkit/core/formatter.rs
1//! Formatter core functionality
2
3
4/// An output for formatter.
5
6pub trait FormatterOutput {
7 fn write_str(&mut self, s: &str);
8 fn write_fmt(&mut self, args: core::fmt::Arguments<'_>);
9}
10
11impl FormatterOutput for String {
12 fn write_str(&mut self, s: &str) {
13 self.push_str(s);
14 }
15
16 fn write_fmt(&mut self, args: core::fmt::Arguments<'_>) {
17 core::fmt::write(self, args).unwrap();
18 }
19}
20