Merge pull request #25 from erickt/master

Shrink down the dependency on tokio
This commit is contained in:
quininer 2019-01-12 12:34:27 +08:00 committed by GitHub
commit d98212a3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -15,7 +15,8 @@ travis-ci = { repository = "quininer/tokio-rustls" }
appveyor = { repository = "quininer/tokio-rustls" } appveyor = { repository = "quininer/tokio-rustls" }
[dependencies] [dependencies]
tokio = { version = "0.1.6", optional = true } futures = { version = "0.1", optional = true }
tokio-io = { version = "0.1.6", optional = true }
bytes = { version = "0.4", optional = true } bytes = { version = "0.4", optional = true }
iovec = { version = "0.1", optional = true } iovec = { version = "0.1", optional = true }
rustls = "0.14" rustls = "0.14"
@ -28,4 +29,4 @@ lazy_static = "1"
[features] [features]
default = ["tokio-support"] default = ["tokio-support"]
nightly = ["bytes", "iovec"] nightly = ["bytes", "iovec"]
tokio-support = ["tokio"] tokio-support = ["futures", "tokio-io"]

View File

@ -10,7 +10,7 @@ use rustls::Session;
use rustls::WriteV; use rustls::WriteV;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
#[cfg(feature = "tokio-support")] #[cfg(feature = "tokio-support")]
use tokio::io::AsyncWrite; use tokio_io::AsyncWrite;
pub struct Stream<'a, S: 'a, IO: 'a> { pub struct Stream<'a, S: 'a, IO: 'a> {
@ -91,7 +91,7 @@ impl<'a, S: Session, IO: Read + Write> WriteTls<'a, S, IO> for Stream<'a, S, IO>
#[cfg(feature = "tokio-support")] #[cfg(feature = "tokio-support")]
impl<'a, S: Session, IO: Read + AsyncWrite> WriteTls<'a, S, IO> for Stream<'a, S, IO> { impl<'a, S: Session, IO: Read + AsyncWrite> WriteTls<'a, S, IO> for Stream<'a, S, IO> {
fn write_tls(&mut self) -> io::Result<usize> { fn write_tls(&mut self) -> io::Result<usize> {
use tokio::prelude::Async; use futures::Async;
use self::vecbuf::VecBuf; use self::vecbuf::VecBuf;
struct V<'a, IO: 'a>(&'a mut IO); struct V<'a, IO: 'a>(&'a mut IO);

View File

@ -6,7 +6,9 @@ pub extern crate rustls;
pub extern crate webpki; pub extern crate webpki;
#[cfg(feature = "tokio-support")] #[cfg(feature = "tokio-support")]
extern crate tokio; extern crate futures;
#[cfg(feature = "tokio-support")]
extern crate tokio_io;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
#[cfg(feature = "tokio-support")] #[cfg(feature = "tokio-support")]
extern crate bytes; extern crate bytes;

View File

@ -1,7 +1,6 @@
use super::*; use super::*;
use tokio::prelude::*; use tokio_io::{ AsyncRead, AsyncWrite };
use tokio::io::{ AsyncRead, AsyncWrite }; use futures::{Async, Future, Poll};
use tokio::prelude::Poll;
use common::Stream; use common::Stream;