Rename fmt::Writer to fmt::Write

This brings it in line with its namesake in `std::io`.

[breaking-change]
This commit is contained in:
Chris Wong 2015-02-14 12:56:32 +13:00
parent cf636c233d
commit bc9084b9b7
11 changed files with 35 additions and 35 deletions

View file

@ -314,7 +314,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
end: &'a mut uint,
}
impl<'a> fmt::Writer for Filler<'a> {
impl<'a> fmt::Write for Filler<'a> {
fn write_str(&mut self, s: &str) -> fmt::Result {
slice::bytes::copy_memory(&mut self.buf[(*self.end)..],
s.as_bytes());

View file

@ -57,14 +57,14 @@ pub struct Error;
/// A collection of methods that are required to format a message into a stream.
///
/// This trait is the type which this modules requires when formatting
/// information. This is similar to the standard library's `io::Writer` trait,
/// information. This is similar to the standard library's `io::Write` trait,
/// but it is only intended for use in libcore.
///
/// This trait should generally not be implemented by consumers of the standard
/// library. The `write!` macro accepts an instance of `io::Writer`, and the
/// `io::Writer` trait is favored over implementing this trait.
/// library. The `write!` macro accepts an instance of `io::Write`, and the
/// `io::Write` trait is favored over implementing this trait.
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Writer {
pub trait Write {
/// Writes a slice of bytes into this writer, returning whether the write
/// succeeded.
///
@ -85,12 +85,12 @@ pub trait Writer {
#[stable(feature = "rust1", since = "1.0.0")]
fn write_fmt(&mut self, args: Arguments) -> Result {
// This Adapter is needed to allow `self` (of type `&mut
// Self`) to be cast to a FormatWriter (below) without
// Self`) to be cast to a Write (below) without
// requiring a `Sized` bound.
struct Adapter<'a,T: ?Sized +'a>(&'a mut T);
impl<'a, T: ?Sized> Writer for Adapter<'a, T>
where T: Writer
impl<'a, T: ?Sized> Write for Adapter<'a, T>
where T: Write
{
fn write_str(&mut self, s: &str) -> Result {
self.0.write_str(s)
@ -116,7 +116,7 @@ pub struct Formatter<'a> {
width: Option<uint>,
precision: Option<uint>,
buf: &'a mut (Writer+'a),
buf: &'a mut (Write+'a),
curarg: slice::Iter<'a, ArgumentV1<'a>>,
args: &'a [ArgumentV1<'a>],
}
@ -367,7 +367,7 @@ pub trait UpperExp {
/// * output - the buffer to write output to
/// * args - the precompiled arguments generated by `format_args!`
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(output: &mut Writer, args: Arguments) -> Result {
pub fn write(output: &mut Write, args: Arguments) -> Result {
let mut formatter = Formatter {
flags: 0,
width: None,