Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do I need a runtime? #42

Open
05storm26 opened this issue Mar 11, 2023 · 1 comment
Open

Why do I need a runtime? #42

05storm26 opened this issue Mar 11, 2023 · 1 comment

Comments

@05storm26
Copy link

05storm26 commented Mar 11, 2023

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


@aljazerzen
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants