mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-01 00:00:10 +02:00
A first pass at updating Tokio to use `std::future`. Implementations of `Future` from the futures crate are updated to implement `Future` from std. Implementations of `Stream` are moved to a feature flag. This commits disables a number of crates that have not yet been updated.
41 lines
1.4 KiB
Rust
41 lines
1.4 KiB
Rust
#![doc(html_root_url = "https://docs.rs/tokio-tcp/0.1.3")]
|
|
#![deny(missing_docs, missing_debug_implementations, rust_2018_idioms)]
|
|
#![cfg_attr(test, deny(warnings))]
|
|
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
|
|
|
|
//! TCP bindings for `tokio`.
|
|
//!
|
|
//! This module contains the TCP networking types, similar to the standard
|
|
//! library, which can be used to implement networking protocols.
|
|
//!
|
|
//! Connecting to an address, via TCP, can be done using [`TcpStream`]'s
|
|
//! [`connect`] method, which returns a future which returns a `TcpStream`.
|
|
//!
|
|
//! To listen on an address [`TcpListener`] can be used. `TcpListener`'s
|
|
//! [`incoming`][incoming_method] method can be used to accept new connections.
|
|
//! It return the [`Incoming`] struct, which implements a stream which returns
|
|
//! `TcpStream`s.
|
|
//!
|
|
//! [`TcpStream`]: struct.TcpStream.html
|
|
//! [`connect`]: struct.TcpStream.html#method.connect
|
|
//! [`TcpListener`]: struct.TcpListener.html
|
|
//! [incoming_method]: struct.TcpListener.html#method.incoming
|
|
//! [`Incoming`]: struct.Incoming.html
|
|
|
|
macro_rules! ready {
|
|
($e:expr) => {
|
|
match $e {
|
|
::std::task::Poll::Ready(t) => t,
|
|
::std::task::Poll::Pending => return ::std::task::Poll::Pending,
|
|
}
|
|
};
|
|
}
|
|
|
|
#[cfg(feature = "incoming")]
|
|
mod incoming;
|
|
mod listener;
|
|
mod stream;
|
|
|
|
pub use self::listener::TcpListener;
|
|
pub use self::stream::TcpStream;
|