Skip to content

Commit

Permalink
Remove tokio support (rust-lang#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
Expyron authored Jan 20, 2022
1 parent b2e976d commit 4e5e0c5
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 502 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
- run: cargo test --features cloudflare_zlib --no-default-features
if: matrix.build != 'mingw'
- run: cargo test --features miniz-sys --no-default-features
- run: cargo test --features tokio

rustfmt:
name: Rustfmt
Expand Down
7 changes: 0 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ cfg-if = "1.0.0"
miniz-sys = { path = "miniz-sys", version = "0.1.11", optional = true }
libz-sys = { version = "1.1.0", optional = true, default-features = false }
cloudflare-zlib-sys = { version = "0.3.0", optional = true }
tokio-io = { version = "0.1.11", optional = true }
futures = { version = "0.1.25", optional = true }
miniz_oxide = { version = "0.4.0", optional = true, default-features = false }
crc32fast = "1.2.0"

Expand All @@ -36,10 +34,6 @@ miniz_oxide = { version = "0.4.0", default-features = false }
[dev-dependencies]
rand = "0.7"
quickcheck = { version = "0.9", default-features = false }
tokio-io = "0.1.11"
tokio-tcp = "0.1.3"
tokio-threadpool = "0.1.10"
futures = "0.1"

[features]
default = ["rust_backend"]
Expand All @@ -48,4 +42,3 @@ zlib = ["any_zlib", "libz-sys"]
zlib-ng-compat = ["zlib", "libz-sys/zlib-ng"]
cloudflare_zlib = ["any_zlib", "cloudflare-zlib-sys"]
rust_backend = ["miniz_oxide"]
tokio = ["tokio-io", "futures"]
25 changes: 0 additions & 25 deletions src/deflate/bufread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ use std::io;
use std::io::prelude::*;
use std::mem;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use crate::zio;
use crate::{Compress, Decompress};

Expand Down Expand Up @@ -116,9 +111,6 @@ impl<R: BufRead> Read for DeflateEncoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + BufRead> AsyncRead for DeflateEncoder<R> {}

impl<W: BufRead + Write> Write for DeflateEncoder<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -129,13 +121,6 @@ impl<W: BufRead + Write> Write for DeflateEncoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + BufRead> AsyncWrite for DeflateEncoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}

/// A DEFLATE decoder, or decompressor.
///
/// This structure consumes a [`BufRead`] interface, reading compressed data
Expand Down Expand Up @@ -247,9 +232,6 @@ impl<R: BufRead> Read for DeflateDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + BufRead> AsyncRead for DeflateDecoder<R> {}

impl<W: BufRead + Write> Write for DeflateDecoder<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -259,10 +241,3 @@ impl<W: BufRead + Write> Write for DeflateDecoder<W> {
self.get_mut().flush()
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + BufRead> AsyncWrite for DeflateDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}
25 changes: 0 additions & 25 deletions src/deflate/read.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use std::io;
use std::io::prelude::*;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use super::bufread;
use crate::bufreader::BufReader;

Expand Down Expand Up @@ -113,9 +108,6 @@ impl<R: Read> Read for DeflateEncoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead> AsyncRead for DeflateEncoder<R> {}

impl<W: Read + Write> Write for DeflateEncoder<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -126,13 +118,6 @@ impl<W: Read + Write> Write for DeflateEncoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + AsyncWrite> AsyncWrite for DeflateEncoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}

/// A DEFLATE decoder, or decompressor.
///
/// This structure implements a [`Read`] interface and takes a stream of
Expand Down Expand Up @@ -245,9 +230,6 @@ impl<R: Read> Read for DeflateDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead> AsyncRead for DeflateDecoder<R> {}

impl<W: Read + Write> Write for DeflateDecoder<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -257,10 +239,3 @@ impl<W: Read + Write> Write for DeflateDecoder<W> {
self.get_mut().flush()
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + AsyncRead> AsyncWrite for DeflateDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}
27 changes: 0 additions & 27 deletions src/deflate/write.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use std::io;
use std::io::prelude::*;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use crate::zio;
use crate::{Compress, Decompress};

Expand Down Expand Up @@ -166,23 +161,12 @@ impl<W: Write> Write for DeflateEncoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncWrite> AsyncWrite for DeflateEncoder<W> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.inner.finish()?;
self.inner.get_mut().shutdown()
}
}

impl<W: Read + Write> Read for DeflateEncoder<W> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.inner.get_mut().read(buf)
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncRead + AsyncWrite> AsyncRead for DeflateEncoder<W> {}

/// A DEFLATE decoder, or decompressor.
///
/// This structure implements a [`Write`] and will emit a stream of decompressed
Expand Down Expand Up @@ -331,19 +315,8 @@ impl<W: Write> Write for DeflateDecoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncWrite> AsyncWrite for DeflateDecoder<W> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.inner.finish()?;
self.inner.get_mut().shutdown()
}
}

impl<W: Read + Write> Read for DeflateDecoder<W> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.inner.get_mut().read(buf)
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncRead + AsyncWrite> AsyncRead for DeflateDecoder<W> {}
35 changes: 0 additions & 35 deletions src/gz/bufread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ use std::io;
use std::io::prelude::*;
use std::mem;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use super::{GzBuilder, GzHeader};
use super::{FCOMMENT, FEXTRA, FHCRC, FNAME};
use crate::crc::{Crc, CrcReader};
Expand Down Expand Up @@ -610,9 +605,6 @@ impl<R: BufRead> Read for GzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + BufRead> AsyncRead for GzDecoder<R> {}

impl<R: BufRead + Write> Write for GzDecoder<R> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -623,13 +615,6 @@ impl<R: BufRead + Write> Write for GzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + BufRead> AsyncWrite for GzDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}

/// A gzip streaming decoder that decodes all members of a multistream
///
/// A gzip member consists of a header, compressed data and a trailer. The [gzip
Expand Down Expand Up @@ -713,26 +698,6 @@ impl<R: BufRead> Read for MultiGzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + BufRead> AsyncRead for MultiGzDecoder<R> {}

impl<R: BufRead + Write> Write for MultiGzDecoder<R> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
}

fn flush(&mut self) -> io::Result<()> {
self.get_mut().flush()
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + BufRead> AsyncWrite for MultiGzDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}

#[cfg(test)]
pub mod tests {
use crate::gz::bufread::*;
Expand Down
25 changes: 0 additions & 25 deletions src/gz/read.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use std::io;
use std::io::prelude::*;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use super::bufread;
use super::{GzBuilder, GzHeader};
use crate::bufreader::BufReader;
Expand Down Expand Up @@ -175,9 +170,6 @@ impl<R: Read> Read for GzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead> AsyncRead for GzDecoder<R> {}

impl<R: Read + Write> Write for GzDecoder<R> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -188,13 +180,6 @@ impl<R: Read + Write> Write for GzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + AsyncRead> AsyncWrite for GzDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}

/// A gzip streaming decoder that decodes all members of a multistream
///
/// A gzip member consists of a header, compressed data and a trailer. The [gzip
Expand Down Expand Up @@ -282,9 +267,6 @@ impl<R: Read> Read for MultiGzDecoder<R> {
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead> AsyncRead for MultiGzDecoder<R> {}

impl<R: Read + Write> Write for MultiGzDecoder<R> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
Expand All @@ -294,10 +276,3 @@ impl<R: Read + Write> Write for MultiGzDecoder<R> {
self.get_mut().flush()
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncWrite + AsyncRead> AsyncWrite for MultiGzDecoder<R> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.get_mut().shutdown()
}
}
27 changes: 0 additions & 27 deletions src/gz/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ use std::cmp;
use std::io;
use std::io::prelude::*;

#[cfg(feature = "tokio")]
use futures::Poll;
#[cfg(feature = "tokio")]
use tokio_io::{AsyncRead, AsyncWrite};

use super::bufread::{corrupt, read_gz_header};
use super::{GzBuilder, GzHeader};
use crate::crc::{Crc, CrcWriter};
Expand Down Expand Up @@ -158,23 +153,12 @@ impl<W: Write> Write for GzEncoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncWrite> AsyncWrite for GzEncoder<W> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.try_finish()?;
self.get_mut().shutdown()
}
}

impl<R: Read + Write> Read for GzEncoder<R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.get_mut().read(buf)
}
}

#[cfg(feature = "tokio")]
impl<R: AsyncRead + AsyncWrite> AsyncRead for GzEncoder<R> {}

impl<W: Write> Drop for GzEncoder<W> {
fn drop(&mut self) {
if self.inner.is_present() {
Expand Down Expand Up @@ -383,23 +367,12 @@ impl<W: Write> Write for GzDecoder<W> {
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncWrite> AsyncWrite for GzDecoder<W> {
fn shutdown(&mut self) -> Poll<(), io::Error> {
self.try_finish()?;
self.inner.get_mut().get_mut().shutdown()
}
}

impl<W: Read + Write> Read for GzDecoder<W> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.inner.get_mut().get_mut().read(buf)
}
}

#[cfg(feature = "tokio")]
impl<W: AsyncRead + AsyncWrite> AsyncRead for GzDecoder<W> {}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading

0 comments on commit 4e5e0c5

Please sign in to comment.