Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tokio support #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
run: echo LZMA_API_STATIC=1 >> $GITHUB_ENV
shell: bash
- run: cargo test
- run: cargo test --features tokio
- run: cargo run --manifest-path systest/Cargo.toml
if: matrix.static == 'yes'

Expand Down
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ members = ["systest"]

[dependencies]
lzma-sys = { path = "lzma-sys", version = "0.1.18" }
tokio-io = { version = "0.1.12", optional = true }
futures = { version = "0.1.26", optional = true }

[dev-dependencies]
rand = "0.8.0"
quickcheck = "1.0.1"
tokio-core = "0.1.17"

[features]
tokio = ["tokio-io", "futures"]
static = ["lzma-sys/static"]

[package.metadata.docs.rs]
features = ["tokio-io", "futures"]
features = []
25 changes: 0 additions & 25 deletions src/bufread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ use lzma_sys;
use std::io;
use std::io::prelude::*;

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

use crate::stream::{Action, Check, Status, Stream};

/// An xz encoder, or compressor.
Expand Down Expand Up @@ -119,9 +114,6 @@ impl<R: BufRead> Read for XzEncoder<R> {
}
}

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

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

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

impl<R: BufRead> XzDecoder<R> {
/// Creates a new decoder which will decompress data read from the given
/// stream.
Expand Down Expand Up @@ -237,9 +222,6 @@ impl<R: BufRead> Read for XzDecoder<R> {
}
}

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

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

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

#[cfg(test)]
mod tests {
use crate::bufread::{XzDecoder, XzEncoder};
Expand Down
20 changes: 0 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,6 @@
//! ```toml
//! xz2 = { version = "0.1.6", features = ["static"] }
//! ```
//!
//! # Async I/O
//!
//! This crate optionally can support async I/O streams with the Tokio stack via
//! the `tokio` feature of this crate:
//!
//! ```toml
//! xz2 = { version = "0.1.6", features = ["tokio"] }
//! ```
//!
//! All methods are internally capable of working with streams that may return
//! `ErrorKind::WouldBlock` when they're not ready to perform the particular
//! operation.
//!
//! Note that care needs to be taken when using these objects, however. The
//! Tokio runtime, in particular, requires that data is fully flushed before
//! dropping streams. For compatibility with blocking streams all streams are
//! flushed/written when they are dropped, and this is not always a suitable
//! time to perform I/O. If I/O streams are flushed before drop, however, then
//! these operations will be a noop.

#![deny(missing_docs)]
#![doc(html_root_url = "https://docs.rs/xz2/0.1")]
Expand Down
25 changes: 0 additions & 25 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
use std::io::prelude::*;
use std::io::{self, BufReader};

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

use crate::bufread;
use crate::stream::Stream;

Expand Down Expand Up @@ -88,9 +83,6 @@ impl<R: Read> Read for XzEncoder<R> {
}
}

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

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

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

impl<R: Read> XzDecoder<R> {
/// Create a new decompression stream, which will read compressed
/// data from the given input stream, and decompress one xz stream.
Expand Down Expand Up @@ -179,9 +164,6 @@ impl<R: Read> Read for XzDecoder<R> {
}
}

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

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

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

#[cfg(test)]
mod tests {
use crate::read::{XzDecoder, XzEncoder};
Expand Down
27 changes: 0 additions & 27 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ use lzma_sys;
use std::io;
use std::io::prelude::*;

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

use crate::stream::{Action, Check, Status, Stream};

/// A compression stream which will have uncompressed data written to it and
Expand Down Expand Up @@ -150,23 +145,12 @@ impl<W: Write> Write for XzEncoder<W> {
}
}

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

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

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

impl<W: Write> Drop for XzEncoder<W> {
fn drop(&mut self) {
if self.obj.is_some() {
Expand Down Expand Up @@ -291,23 +275,12 @@ impl<W: Write> Write for XzDecoder<W> {
}
}

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

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

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

impl<W: Write> Drop for XzDecoder<W> {
fn drop(&mut self) {
if self.obj.is_some() {
Expand Down
123 changes: 0 additions & 123 deletions tests/tokio.rs

This file was deleted.