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