Don't discourage implementing `core::fmt::Write`
Explain when you should use it and when you should not.
This commit is contained in:
parent
ea7e131435
commit
c17d067018
|
@ -92,18 +92,14 @@ pub type Result = result::Result<(), Error>;
|
||||||
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||||
pub struct Error;
|
pub struct Error;
|
||||||
|
|
||||||
/// A collection of methods that are required to format a message into a stream.
|
/// A trait for writing or formatting into Unicode-accepting buffers or streams.
|
||||||
///
|
///
|
||||||
/// This trait is the type which this modules requires when formatting
|
/// This trait only accepts UTF-8–encoded data and is not [flushable]. If you only
|
||||||
/// information. This is similar to the standard library's [`io::Write`] trait,
|
/// want to accept Unicode and you don't need flushing, you should implement this trait;
|
||||||
/// but it is only intended for use in libcore.
|
/// otherwise you should implement [`std::io::Write`].
|
||||||
///
|
///
|
||||||
/// This trait should generally not be implemented by consumers of the standard
|
/// [`std::io::Write`]: ../../std/io/trait.Write.html
|
||||||
/// library. The [`write!`] macro accepts an instance of [`io::Write`], and the
|
/// [flushable]: ../../std/io/trait.Write.html#tymethod.flush
|
||||||
/// [`io::Write`] trait is favored over implementing this trait.
|
|
||||||
///
|
|
||||||
/// [`write!`]: crate::write!
|
|
||||||
/// [`io::Write`]: ../../std/io/trait.Write.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub trait Write {
|
pub trait Write {
|
||||||
/// Writes a string slice into this writer, returning whether the write
|
/// Writes a string slice into this writer, returning whether the write
|
||||||
|
|
Loading…
Reference in New Issue