Repository: tokio-rs/tokio
File: tokio/src/io/stdout.rs (Rust)

Code before:
    ///     let mut stdout = io::stdout();
    ///
    ///     for message in &messages {
    ///         stdout.write_all(message.as_bytes()).await.unwrap();
    ///         stdout.flush().await.unwrap();
    ///     }
    /// }
    /// ```
    #[derive(Debug)]
    pub struct Stdout {
        std: SplitByUtf8BoundaryIfWindows<Blocking<std::io::Stdout>>,
    }

    /// Constructs a new handle to the standard output of the current process.
    ///
    /// The returned handle allows writing to standard out from the within the
    /// Tokio runtime.
    ///
    /// Concurrent writes to stdout must be executed with care: Only individual
    /// writes to this [`AsyncWrite`] are guaranteed to be intact. In particular
    /// you should be aware that writes using [`write_all`] are not guaranteed
    /// to occur as a single write, so multiple threads writing data with
    /// [`write_all`] may result in interleaved output.
    ///
    /// Note that unlike [`std::io::stdout`], each call to this `stdout()`
    /// produces a new writer, so for example, this program does not flush stdout:
    ///
    /// ```no_run
    /// # use tokio::io::AsyncWriteExt;
    /// # #[tokio::main]
    /// # async fn main() -> std::io::Result<()> {
    /// tokio::io::stdout().write_all(b"aa").await?;
    /// tokio::io::stdout().flush().await?;
    /// # Ok(())
    /// # }
    /// ```
    ///
    /// [`std::io::stdout`]: std::io::stdout
    /// [`AsyncWrite`]: AsyncWrite
    /// [`write_all`]: crate::io::AsyncWriteExt::write_all()
    ///
    /// # Examples
    ///
    /// ```
    /// use tokio::io::{self, AsyncWriteExt};
    ///
    /// #[tokio::main]
    /// async fn main() -> io::Result<()> {
    ///     let mut stdout = io::stdout();
    ///     stdout.write_all(b"Hello world!").await?;
    ///     Ok(())

Review comment (suggestion):
```suggestion
    /// produces a new writer, so for example, this program does **not** flush stdout:
```

Code after:
    ///     let mut stdout = io::stdout();
    ///
    ///     for message in &messages {
    ///         stdout.write_all(message.as_bytes()).await.unwrap();
    ///         stdout.flush().await.unwrap();
    ///     }
    /// }
    /// ```
    #[derive(Debug)]
    pub struct Stdout {
        std: SplitByUtf8BoundaryIfWindows<Blocking<std::io::Stdout>>,
    }

    /// Constructs a new handle to the standard output of the current process.
    ///
    /// The returned handle allows writing to standard out from the within the
    /// Tokio runtime.
    ///
    /// Concurrent writes to stdout must be executed with care: Only individual
    /// writes to this [`AsyncWrite`] are guaranteed to be intact. In particular
    /// you should be aware that writes using [`write_all`] are not guaranteed
    /// to occur as a single write, so multiple threads writing data with
    /// [`write_all`] may result in interleaved output.
    ///
    /// Note that unlike [`std::io::stdout`], each call to this `stdout()`
    /// produces a new writer, so for example, this program does **not** flush stdout:
    ///
    /// ```no_run
    /// # use tokio::io::AsyncWriteExt;
    /// # #[tokio::main]
    /// # async fn main() -> std::io::Result<()> {
    /// tokio::io::stdout().write_all(b"aa").await?;
    /// tokio::io::stdout().flush().await?;
    /// # Ok(())
    /// # }
    /// ```
    ///
    /// [`std::io::stdout`]: std::io::stdout
    /// [`AsyncWrite`]: AsyncWrite
    /// [`write_all`]: crate::io::AsyncWriteExt::write_all()
    ///
    /// # Examples
    ///
    /// ```
    /// use tokio::io::{self, AsyncWriteExt};
    ///
    /// #[tokio::main]
    /// async fn main() -> io::Result<()> {
    ///     let mut stdout = io::stdout();
    ///     stdout.write_all(b"Hello world!").await?;
    ///     Ok(())