Blog Post Feedback - Intro to HTTP requests with Reqwest


#1

I’m trying to get some teammates and dev friends interested in Rust, and I’m writing a few blog posts about how to do common, simple tasks in the language. The first one is on how to make HTTP requests with reqwest. I was hoping I could get some community feedback before I share it with any non Rust folks. I don’t want to misrepresent anything or spread any incorrect info.

Any feedback is welcome!


#2

Very nice and simple examples :+1:


#3

Nice and clear! The only things I would suggest are

  • consume the Result as you’ll get a warning
  • fix typos in the description :wink:

#4

What’s the best way to do this, and still leave the function open to be quickly edited and reused by the reader?

Yeah… typos. I normally have someone edit my writing, but didn’t this time.

Thanks for the feedback!


#5

A couple of options:

let _ = returns_result();
// or
returns_result().unwrap(); // or expect() instead of unwrap()

#6

Or a trivial match

fn main() {
    match run() {
        Ok(data) => println!("Obtained '{}'", data),
        Err(err) => eprintln!("Error '{}'", err),
    }
}

But I would just go with expect for simplicity.


#7

I like the use of match a lot. I’ll pull that together tomorrow when I have time to make some edits.