impl read_initializer

This commit is contained in:
quininer 2018-09-06 13:56:00 +08:00
parent 686b75bd46
commit 9378e415ce
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,8 @@
mod vecbuf; mod vecbuf;
use std::io::{ self, Read, Write }; use std::io::{ self, Read, Write };
#[cfg(feature = "nightly")]
use std::io::Initializer;
use rustls::Session; use rustls::Session;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustls::WriteV; 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> { 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<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
while self.session.wants_read() { while self.session.wants_read() {
if let (0, 0) = self.complete_io()? { if let (0, 0) = self.complete_io()? {

View File

@ -1,6 +1,6 @@
//! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls). //! 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 rustls;
pub extern crate webpki; pub extern crate webpki;