Attempt to make AnsiOutput
play nicer with write!
This commit is contained in:
parent
4d60ac91b3
commit
0eba0e2056
@ -16,23 +16,21 @@ impl IStdout for AnsiOutput {
|
|||||||
fn write_str(&self, string: &str) -> io::Result<usize> {
|
fn write_str(&self, string: &str) -> io::Result<usize> {
|
||||||
let out = &self.handle;
|
let out = &self.handle;
|
||||||
let mut handle = out.lock();
|
let mut handle = out.lock();
|
||||||
write!(handle, "{}", string)?;
|
let amt = handle.write(string.as_bytes())?;
|
||||||
handle.flush();
|
handle.flush()?;
|
||||||
Ok(0)
|
Ok(amt)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&self, buf: &[u8]) -> io::Result<usize> {
|
fn write(&self, buf: &[u8]) -> io::Result<usize> {
|
||||||
let out = &self.handle;
|
let out = &self.handle;
|
||||||
let mut handle = out.lock();
|
let mut handle = out.lock();
|
||||||
handle.write(buf)?;
|
handle.write(buf)
|
||||||
Ok(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush(&self) -> io::Result<()> {
|
fn flush(&self) -> io::Result<()> {
|
||||||
let out = &self.handle;
|
let out = &self.handle;
|
||||||
let mut handle = out.lock();
|
let mut handle = out.lock();
|
||||||
handle.flush();
|
handle.flush()
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_any(&self) -> &Any {
|
fn as_any(&self) -> &Any {
|
||||||
|
Loading…
Reference in New Issue
Block a user