drogue-iot / reqwless

Rust async HTTP client for embedded/no_std
Apache License 2.0
129 stars 18 forks source link

Reqwless 1.3.0 compile error due to different embedded-nal-async version in embassy-net #93

Closed gustavowd closed 1 month ago

gustavowd commented 1 month ago

Hi. I update reqwless to version 1.3.0 in my esp32-c3 project and start to receive several compilation erros:

Compiling reqwless v0.13.0 error[E0277]: the trait bound TcpClient<'_, WifiDevice<'static, WifiStaDevice>, 1, 4096, 4096>: embedded_nal_async::stack::tcp::TcpConnect is not satisfied --> src/http.rs:103:51 103 let mut client = HttpClient::new_with_tls(&tcp_client, &dns_socket, tls_config); ------------------------ ^^^^^^^^^^^ the trait embedded_nal_async::stack::tcp::TcpConnect is not implemented for TcpClient<'_, WifiDevice<'static, WifiStaDevice>, 1, 4096, 4096>
required by a bound introduced by this call
help: trait impl with same name found --> /home/gustavo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embassy-net-0.4.0/src/tcp.rs:634:5 634 / impl<'d, D: Driver, const N: usize, const TX_SZ: usize, const RX_SZ: usize> embedded_nal_async::TcpConnect 635 for TcpClient<'d, D, N, TX_SZ, RX_SZ> _____^ = note: perhaps two different versions of crate embedded_nal_async are being used? = help: the trait embedded_nal_async::stack::tcp::TcpConnect is implemented for &T note: required by a bound in HttpClient::<'a, T, D>::new_with_tls --> /home/gustavo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwless-0.13.0/src/client.rs:99:8
99 T: TcpConnect + 'a,
^^^^^^^^^^ required by this bound in HttpClient::<'a, T, D>::new_with_tls

... 114 | pub fn new_with_tls(client: &'a T, dns: &'a D, tls: TlsConfig<'a>) -> Self { | ------------ required by a bound in this associated function

error[E0277]: the trait bound TcpClient<'_, WifiDevice<'static, WifiStaDevice>, 1, 4096, 4096>: embedded_nal_async::stack::tcp::TcpConnect is not satisfied --> src/http.rs:103:26 103 let mut client = HttpClient::new_with_tls(&tcp_client, &dns_socket, tls_config); ^^^^^^^^^^ the trait embedded_nal_async::stack::tcp::TcpConnect is not implemented for TcpClient<'_, WifiDevice<'static, WifiStaDevice>, 1, 4096, 4096>
help: trait impl with same name found --> /home/gustavo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embassy-net-0.4.0/src/tcp.rs:634:5 634 / impl<'d, D: Driver, const N: usize, const TX_SZ: usize, const RX_SZ: usize> embedded_nal_async::TcpConnect 635 for TcpClient<'d, D, N, TX_SZ, RX_SZ> _____^ = note: perhaps two different versions of crate embedded_nal_async are being used? = help: the trait embedded_nal_async::stack::tcp::TcpConnect is implemented for &T note: required by a bound in HttpClient --> /home/gustavo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwless-0.13.0/src/client.rs:20:8
18 pub struct HttpClient<'a, T, D>
---------- required by a bound in this struct
19 where
20 T: TcpConnect + 'a,
^^^^^^^^^^ required by this bound in HttpClient
error[E0277]: the trait bound DnsSocket<'_, WifiDevice<'static, WifiStaDevice>>: embedded_nal_async::dns::Dns is not satisfied --> src/http.rs:103:64 103 let mut client = HttpClient::new_with_tls(&tcp_client, &dns_socket, tls_config); ------------------------ ^^^^^^^^^^^ the trait embedded_nal_async::dns::Dns is not implemented for DnsSocket<'_, WifiDevice<'static, WifiStaDevice>>
required by a bound introduced by this call

help: trait impl with same name found

Seems to be something related with embedded-nal-async: " note: perhaps two different versions of crate embedded_nal_async are being used?"

Any thoughts on this issue?

lulf commented 1 month ago

If you use embassy-net from crates.io, you should probably stick to reqwless 0.12.1. If you use patched git dependencies for embassy-net, if you use the latest rev, you should be able to use 0.13.0

gustavowd commented 1 month ago

Thanks @lulf . I'm using a local copy of crates.io embassy-net. I update the embedded_nal_async crate in this local copy and now is everything working like a charm.