diff options
author | Carl Lerche <me@carllerche.com> | 2020-10-12 16:06:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 16:06:02 -0700 |
commit | 19233508806ddf22a14acf944426e0da8a401df8 (patch) | |
tree | 5a204c0958ecc30f6ef05a464fb5446b398a7e46 /tokio/src/net/tcp | |
parent | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 (diff) |
meta: combine `net` and `dns`, use `parking_lot` (#2951)
This combines the `dns` and `net` feature flags. Previously, `dns` was
included as part of `net`. Given that is is rare that one would want
`dns` without `net`, DNS is now entirely gated w/ `net`.
The `parking_lot` feature is included as part of `full`.
Some misc docs are tweaked to reflect feature flag changes.
Diffstat (limited to 'tokio/src/net/tcp')
-rw-r--r-- | tokio/src/net/tcp/listener.rs | 21 | ||||
-rw-r--r-- | tokio/src/net/tcp/stream.rs | 22 |
2 files changed, 2 insertions, 41 deletions
diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 57500615..d3323ae0 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -80,7 +80,7 @@ impl TcpListener { /// method. /// /// The address type can be any implementor of the [`ToSocketAddrs`] trait. - /// Note that strings only implement this trait when the **`dns`** feature + /// Note that strings only implement this trait when the **`net`** feature /// is enabled, as strings may contain domain names that need to be resolved. /// /// If `addr` yields multiple addresses, bind will be attempted with each of @@ -109,25 +109,6 @@ impl TcpListener { /// Ok(()) /// } /// ``` - /// - /// Without the `dns` feature: - /// - /// ```no_run - /// use tokio::net::TcpListener; - /// use std::net::Ipv4Addr; - /// - /// use std::io; - /// - /// #[tokio::main] - /// async fn main() -> io::Result<()> { - /// let listener = TcpListener::bind((Ipv4Addr::new(127, 0, 0, 1), 2345)).await?; - /// - /// // use the listener - /// - /// # let _ = listener; - /// Ok(()) - /// } - /// ``` pub async fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> { let addrs = to_socket_addrs(addr).await?; diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index 7acab7db..f90e9a39 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -61,7 +61,7 @@ impl TcpStream { /// /// `addr` is an address of the remote host. Anything which implements the /// [`ToSocketAddrs`] trait can be supplied as the address. Note that - /// strings only implement this trait when the **`dns`** feature is enabled, + /// strings only implement this trait when the **`net`** feature is enabled, /// as strings may contain domain names that need to be resolved. /// /// If `addr` yields multiple addresses, connect will be attempted with each @@ -90,26 +90,6 @@ impl TcpStream { /// } /// ``` /// - /// Without the `dns` feature: - /// - /// ```no_run - /// use tokio::net::TcpStream; - /// use tokio::prelude::*; - /// use std::error::Error; - /// use std::net::Ipv4Addr; - /// - /// #[tokio::main] - /// async fn main() -> Result<(), Box<dyn Error>> { - /// // Connect to a peer - /// let mut stream = TcpStream::connect((Ipv4Addr::new(127, 0, 0, 1), 8080)).await?; - /// - /// // Write some data. - /// stream.write_all(b"hello world!").await?; - /// - /// Ok(()) - /// } - /// ``` - /// /// The [`write_all`] method is defined on the [`AsyncWriteExt`] trait. /// /// [`write_all`]: fn@crate::io::AsyncWriteExt::write_all |