std: Rename Writer::write to Writer::write_all

In preparation for upcoming changes to the `Writer` trait (soon to be called
`Write`) this commit renames the current `write` method to `write_all` to match
the semantics of the upcoming `write_all` method. The `write` method will be
repurposed to return a `usize` indicating how much data was written which
differs from the current `write` semantics. In order to head off as much
unintended breakage as possible, the method is being deprecated now in favor of
a new name.

[breaking-change]
This commit is contained in:
Alex Crichton
2015-01-23 10:46:14 -08:00
parent 3a07f859b8
commit 5d836cdf86
41 changed files with 229 additions and 226 deletions

View File

@@ -496,20 +496,20 @@ impl<T: Writer> ConsoleTestState<T> {
if self.use_color {
try!(term.fg(color));
}
try!(term.write(word.as_bytes()));
try!(term.write_all(word.as_bytes()));
if self.use_color {
try!(term.reset());
}
Ok(())
}
Raw(ref mut stdout) => stdout.write(word.as_bytes())
Raw(ref mut stdout) => stdout.write_all(word.as_bytes())
}
}
pub fn write_plain(&mut self, s: &str) -> old_io::IoResult<()> {
match self.out {
Pretty(ref mut term) => term.write(s.as_bytes()),
Raw(ref mut stdout) => stdout.write(s.as_bytes())
Pretty(ref mut term) => term.write_all(s.as_bytes()),
Raw(ref mut stdout) => stdout.write_all(s.as_bytes())
}
}
@@ -558,7 +558,7 @@ impl<T: Writer> ConsoleTestState<T> {
TrMetrics(ref mm) => mm.fmt_metrics(),
TrBench(ref bs) => fmt_bench_samples(bs)
}, test.name.as_slice());
o.write(s.as_bytes())
o.write_all(s.as_bytes())
}
}
}