blob: fbb632d678a552558993c55101724c288a004b08 [file] [edit]
// Copyright 2025 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::io::{Result, Write};
#[derive(Default, Debug)]
pub struct TestWriter {
_p: (),
}
impl TestWriter {
/// Returns a new `TestWriter` with the default configuration.
pub fn new() -> Self {
Self::default()
}
}
impl Write for TestWriter {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
let out_str = String::from_utf8_lossy(buf);
print!("{}", out_str);
Ok(buf.len())
}
fn flush(&mut self) -> Result<()> {
Ok(())
}
}