From 707ac0be8363bafad1123556d77d495c53513080 Mon Sep 17 00:00:00 2001 From: Brett McChesney <39924297+mcches@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:38:25 -0600 Subject: [PATCH] Update stream.rs docs --- src/net/tcp/stream.rs | 70 ------------------------------------------- 1 file changed, 70 deletions(-) diff --git a/src/net/tcp/stream.rs b/src/net/tcp/stream.rs index 70c5ca6..67c4db8 100644 --- a/src/net/tcp/stream.rs +++ b/src/net/tcp/stream.rs @@ -106,41 +106,6 @@ impl TcpStream { /// If data is successfully written, `Ok(n)` is returned, where `n` is the /// number of bytes written. If the stream is not ready to write data, /// `Err(io::ErrorKind::WouldBlock)` is returned. - /// - /// # Examples - /// - /// ```no_run - /// use turmoil::net::TcpStream; - /// use std::error::Error; - /// use std::io; - /// - /// #[tokio::main] - /// async fn main() -> Result<(), Box> { - /// // Connect to a peer - /// let stream = TcpStream::connect("127.0.0.1:8080").await?; - /// - /// loop { - /// // Wait for the socket to be writable - /// stream.writable().await?; - /// - /// // Try to write data, this may still fail with `WouldBlock` - /// // if the readiness event is a false positive. - /// match stream.try_write(b"hello world") { - /// Ok(n) => { - /// break; - /// } - /// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { - /// continue; - /// } - /// Err(e) => { - /// return Err(e.into()); - /// } - /// } - /// } - /// - /// Ok(()) - /// } - /// ``` pub fn try_write(&self, buf: &[u8]) -> Result { self.write_half.try_write(buf) } @@ -173,41 +138,6 @@ impl TcpStream { /// will continue to return immediately until the readiness event is /// consumed by an attempt to write that fails with `WouldBlock` or /// `Poll::Pending`. - /// - /// # Examples - /// - /// ```no_run - /// use tokio::net::TcpStream; - /// use std::error::Error; - /// use std::io; - /// - /// #[tokio::main] - /// async fn main() -> Result<(), Box> { - /// // Connect to a peer - /// let stream = TcpStream::connect("127.0.0.1:8080").await?; - /// - /// loop { - /// // Wait for the socket to be writable - /// stream.writable().await?; - /// - /// // Try to write data, this may still fail with `WouldBlock` - /// // if the readiness event is a false positive. - /// match stream.try_write(b"hello world") { - /// Ok(n) => { - /// break; - /// } - /// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { - /// continue; - /// } - /// Err(e) => { - /// return Err(e.into()); - /// } - /// } - /// } - /// - /// Ok(()) - /// } - /// ``` pub async fn writable(&self) -> Result<()> { Ok(()) }