Shrink down the dependency on tokio
it turns out that tokio-rustls only requires a small portion of the tokio stack. This patch slims down the dependencies since not all clients need the full tokio stack.
This commit is contained in:
parent
f6e8f86382
commit
6f1787e9d1
@ -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"]
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user