rust-tls-api
rust-tls-api copied to clipboard
Why do I need a runtime?
I am trying to use this to be able to easly switch the tls implementation between rustls and native-tls.
Is there a way to use this crate without an async runtime, with std::net::tcp::TcpStream?
I tried to disable the default features to get rid of the async related stuff from this library but then I get these kind of errors:
[ERROR rust_analyzer::main_loop] FetchBuildDataError:
error[E0432]: unresolved import `crate::runtime::AsyncRead`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/async_as_sync.rs:14:5
|
14 | use crate::runtime::AsyncRead;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncRead` in `runtime`
error[E0432]: unresolved import `crate::runtime::AsyncWrite`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/async_as_sync.rs:15:5
|
15 | use crate::runtime::AsyncWrite;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncWrite` in `runtime`
error[E0432]: unresolved import `crate::runtime::AsyncRead`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/socket.rs:1:5
|
1 | use crate::runtime::AsyncRead;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncRead` in `runtime`
error[E0432]: unresolved import `crate::runtime::AsyncWrite`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/socket.rs:2:5
|
2 | use crate::runtime::AsyncWrite;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncWrite` in `runtime`
error[E0432]: unresolved import `crate::spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/socket_box.rs:8:5
|
8 | use crate::spi_async_socket_impl_delegate;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `spi_async_socket_impl_delegate` in the root
error[E0432]: unresolved import `crate::spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream.rs:4:5
|
4 | use crate::spi_async_socket_impl_delegate;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `spi_async_socket_impl_delegate` in the root
error[E0432]: unresolved import `crate::runtime::AsyncRead`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream_with_socket.rs:8:5
|
8 | use crate::runtime::AsyncRead;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncRead` in `runtime`
error[E0432]: unresolved import `crate::runtime::AsyncWrite`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream_with_socket.rs:9:5
|
9 | use crate::runtime::AsyncWrite;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncWrite` in `runtime`
error[E0432]: unresolved import `crate::spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream_with_socket.rs:12:5
|
12 | use crate::spi_async_socket_impl_delegate;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `spi_async_socket_impl_delegate` in the root
error: cannot determine resolution for the macro `spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/socket_box.rs:49:1
|
49 | spi_async_socket_impl_delegate!(AsyncSocketBox);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: cannot determine resolution for the macro `spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream.rs:52:1
|
52 | spi_async_socket_impl_delegate!(TlsStream);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: cannot determine resolution for the macro `spi_async_socket_impl_delegate`
--> /home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/tls-api-0.9.0/src/stream_with_socket.rs:114:1
|
114 | spi_async_socket_impl_delegate!(TlsStreamWithSocket<S>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0432`.
error: could not compile `tls-api` due to 13 previous errors
From the quick scan of the code, it seems like this crate only provides async API.
https://github.com/stepancheg/rust-tls-api/blob/master/api/src/socket.rs#L5-L10
You should also provide your source code when showing error messages - it is hard to reason about the output if one does not know the input.