From 9378e415ce407bc8e0b26f6e70517b943070e190 Mon Sep 17 00:00:00 2001 From: quininer Date: Thu, 6 Sep 2018 13:56:00 +0800 Subject: [PATCH] impl read_initializer --- src/common/mod.rs | 7 +++++++ src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/mod.rs b/src/common/mod.rs index 8580cc8..7db198e 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -3,6 +3,8 @@ mod vecbuf; use std::io::{ self, Read, Write }; +#[cfg(feature = "nightly")] +use std::io::Initializer; use rustls::Session; #[cfg(feature = "nightly")] use rustls::WriteV; @@ -110,6 +112,11 @@ impl<'a, S: Session, IO: Read + AsyncWrite> WriteTls<'a, S, IO> for Stream<'a, S } impl<'a, S: Session, IO: Read + Write> Read for Stream<'a, S, IO> { + #[cfg(feature = "nightly")] + unsafe fn initializer(&self) -> Initializer { + Initializer::nop() + } + fn read(&mut self, buf: &mut [u8]) -> io::Result { while self.session.wants_read() { if let (0, 0) = self.complete_io()? { diff --git a/src/lib.rs b/src/lib.rs index b06c227..15bce44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ //! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls). -#![cfg_attr(feature = "nightly", feature(specialization))] +#![cfg_attr(feature = "nightly", feature(specialization, read_initializer))] pub extern crate rustls; pub extern crate webpki;