Why does a lazy-static value claim to not implement a trait that it clearly implements?

The compiler isn’t lying to you, you are just skipping over a relevant detail of the error message. Here’s a self-contained example: #[macro_use] extern crate lazy_static; struct Example; trait ExampleTrait {} impl ExampleTrait for Example {} lazy_static! { static ref EXAMPLE: Example = Example; } fn must_have_trait<T>(_: T) where T: ExampleTrait, { } fn main() … Read more

How can I perform parallel asynchronous HTTP GET requests with reqwest?

Concurrent requests As of reqwest 0.10: use futures::{stream, StreamExt}; // 0.3.5 use reqwest::Client; // 0.10.6 use tokio; // 0.2.21, features = [“macros”] const CONCURRENT_REQUESTS: usize = 2; #[tokio::main] async fn main() { let client = Client::new(); let urls = vec![“https://api.ipify.org”; 2]; let bodies = stream::iter(urls) .map(|url| { let client = &client; async move { let … Read more