Rust Anyhow ? Turbofish ::<> / HTTP Calls and Errors
JFrog is a Proud Sponsor of Rust NYC User Group!
10月 17, 2022
2 min read
Anyhow ? Turbofish ::<> / HTTP Calls and Errors in Rust
Rust is a very powerful and full-featured systems language. However, its native idioms (at least in their default implementations) can be quite verbose. Even when you just want to GET a JSON document and do something with it. Explicitly matching every Result case is required to avoid panic. Or is it? Let’s learn together to use turbofish syntax and the anyhow crate to produce more elegant but still idiomatic Rust code that allows us to explicitly handle Result(s) as necessary. We’ll demonstrate making Rest API calls using Rust request and we’ll show how to incrementally minimize the amount of boilerplate it takes.
Elliott Frisch is a Senior Developer at JFrog with over 20 years of software design and development experience in a variety of languages. He has been working in Rust for the past year at JFrog on Pyrsia, an open source decentralized package network. His personal mantra for contributions to software is: producing exceptional products that delight users and stakeholder alike. He enjoys helping other developers with tough challenges and he is currently ranked in the top 500 users of all time on Stackoverflow. His other hobbies include a lifetime of reading and watching science fiction.