tls icon indicating copy to clipboard operation
tls copied to clipboard

The tokio-native-tls/examples/echo failed to compile

Open uudiin opened this issue 5 years ago • 0 comments

error[E0277]: the trait bound tokio::net::TcpStream: tokio::io::async_read::AsyncRead is not satisfied --> src/main.rs:33:54 | 33 | let mut tls_stream = tls_acceptor.accept(socket).await.expect("accept error"); | ^^^^^^ the trait tokio::io::async_read::AsyncRead is not implemented for tokio::net::TcpStream

error[E0277]: the trait bound tokio::net::TcpStream: tokio::io::async_write::AsyncWrite is not satisfied --> src/main.rs:33:54 | 33 | let mut tls_stream = tls_acceptor.accept(socket).await.expect("accept error"); | ^^^^^^ the trait tokio::io::async_write::AsyncWrite is not implemented for tokio::net::TcpStream

error[E0599]: no method named read found for struct tokio_tls::TlsStream<tokio::net::TcpStream> in the current scope --> src/main.rs:38:18 | 38 | .read(&mut buf) | ^^^^ method not found in tokio_tls::TlsStream<tokio::net::TcpStream> | ::: /Users/tianjia/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/tokio-tls-0.3.1/src/lib.rs:60:1 | 60 | pub struct TlsStream<S>(native_tls::TlsStream<AllowStd<S>>); | ------------------------------------------------------------ | | | doesn't satisfy _: AsyncReadExt | doesn't satisfy _: AsyncRead | = note: the method read exists but the following trait bounds were not satisfied: tokio_tls::TlsStream<tokio::net::TcpStream>: AsyncRead which is required by tokio_tls::TlsStream<tokio::net::TcpStream>: AsyncReadExt

error[E0599]: no method named write_all found for struct tokio_tls::TlsStream<tokio::net::TcpStream> in the current scope --> src/main.rs:49:18 | 49 | .write_all(&buf[0..n]) | ^^^^^^^^^ method not found in tokio_tls::TlsStream<tokio::net::TcpStream> | ::: /Users/tianjia/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/tokio-tls-0.3.1/src/lib.rs:60:1 | 60 | pub struct TlsStream<S>(native_tls::TlsStream<AllowStd<S>>); | ------------------------------------------------------------ | | | doesn't satisfy _: AsyncWriteExt | doesn't satisfy _: AsyncWrite | = note: the method write_all exists but the following trait bounds were not satisfied: tokio_tls::TlsStream<tokio::net::TcpStream>: AsyncWrite which is required by tokio_tls::TlsStream<tokio::net::TcpStream>: AsyncWriteExt

uudiin avatar Mar 12 '21 03:03 uudiin