1 use std::fmt; 2 3 pub struct Output(String); 4 5 impl Output { new() -> Self6 pub fn new() -> Self { 7 Output(String::new()) 8 } 9 write_fmt(&mut self, arguments: fmt::Arguments)10 pub fn write_fmt(&mut self, arguments: fmt::Arguments) { 11 fmt::Write::write_fmt(&mut self.0, arguments).unwrap(); 12 } 13 } 14 15 impl AsRef<[u8]> for Output { as_ref(&self) -> &[u8]16 fn as_ref(&self) -> &[u8] { 17 self.0.as_bytes() 18 } 19 } 20