Update Tokio to Rust 2018 (#1082)

This commit is contained in:
Carl Lerche
2019-05-14 10:27:36 -07:00
committed by GitHub
parent 79d8820050
commit cb4aea394e
343 changed files with 1725 additions and 2813 deletions
+4 -6
View File
@@ -1,11 +1,9 @@
use super::UdpSocket;
use bytes::{BufMut, BytesMut};
use futures::{try_ready, Async, AsyncSink, Poll, Sink, StartSend, Stream};
use log::trace;
use std::io;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use futures::{Async, AsyncSink, Poll, Sink, StartSend, Stream};
use super::UdpSocket;
use bytes::{BufMut, BytesMut};
use tokio_codec::{Decoder, Encoder};
/// A unified `Stream` and `Sink` interface to an underlying `UdpSocket`, using
+3 -11
View File
@@ -1,5 +1,7 @@
#![doc(html_root_url = "https://docs.rs/tokio-tcp/0.1.3")]
#![deny(missing_docs, warnings, missing_debug_implementations)]
#![deny(missing_docs, missing_debug_implementations, rust_2018_idioms)]
#![cfg_attr(test, deny(warnings))]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
//! UDP bindings for `tokio`.
//!
@@ -19,16 +21,6 @@
//! [`UdpFramed`]: struct.UdpFramed.html
//! [`framed`]: struct.UdpSocket.html#method.framed
extern crate bytes;
#[macro_use]
extern crate futures;
extern crate mio;
#[macro_use]
extern crate log;
extern crate tokio_codec;
extern crate tokio_io;
extern crate tokio_reactor;
mod frame;
mod recv_dgram;
mod send_dgram;
+7 -12
View File
@@ -1,10 +1,8 @@
use super::socket::UdpSocket;
use futures::{try_ready, Async, Future, Poll};
use std::io;
use std::net::SocketAddr;
use futures::{Async, Future, Poll};
/// A future used to receive a datagram from a UDP socket.
///
/// This is created by the `UdpSocket::recv_dgram` method.
@@ -47,13 +45,15 @@ impl<T> RecvDgram<T> {
/// Consume the `RecvDgram`, returning the socket and buffer.
///
/// # Panics
///
/// If called after the future has completed.
///
/// # Examples
///
/// ```
/// # extern crate tokio_udp;
///
/// use tokio_udp::UdpSocket;
///
/// # pub fn main() {
///
/// let socket = UdpSocket::bind(&([127, 0, 0, 1], 0).into()).unwrap();
/// let mut buffer = vec![0; 4096];
///
@@ -65,12 +65,7 @@ impl<T> RecvDgram<T> {
///
/// let socket = parts.socket; // extract the socket
/// let buffer = parts.buffer; // extract the buffer
///
/// # }
/// ```
/// # Panics
///
/// If called after the future has completed.
pub fn into_parts(mut self) -> Parts<T> {
let state = self
.state
+1 -3
View File
@@ -1,10 +1,8 @@
use super::socket::UdpSocket;
use futures::{try_ready, Async, Future, Poll};
use std::io;
use std::net::SocketAddr;
use futures::{Async, Future, Poll};
/// A future used to write the entire contents of some data to a UDP socket.
///
/// This is created by the `UdpSocket::send_dgram` method.
+3 -6
View File
@@ -1,12 +1,9 @@
use super::{RecvDgram, SendDgram};
use futures::{try_ready, Async, Poll};
use mio;
use std::fmt;
use std::io;
use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr};
use futures::{Async, Poll};
use mio;
use tokio_reactor::{Handle, PollEvented};
/// An I/O object representing a UDP socket.
@@ -422,7 +419,7 @@ impl UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.io.get_ref().fmt(f)
}
}