Simplify connecting to an API with Rust using reqwest and serde_json

preview_player
Показать описание
Sometimes you don't want the full bureaucracy involved when interacting with a web API. There's a faster way!

📚 Resources:

🦀 Rust resources:

👋 Connect with Tim:

👍 Like this video if you found it helpful, and share it with your friends who are also interested in Rust programming.
Рекомендации по теме
Комментарии
Автор

You did not have to define type, but you used additional library and had to to n.as_u64() which is same as defining type. I want to use rust more but this did not make sense for me. Am I missing something?

pixsa
Автор

Thank you for this tip. I feel like defining an Astronaut type is quite a bit more straight and clear in terms of communicating intentions and provides some safeguards against some bugs at the cost of added verbosity and rigidity. Curious about your thoughts on the trade-offs of both approaches. What are the pros/cons of serde_json::Value?

pbnjdev
Автор

Which method is faster for extracting just the 'title' and 'body' from JSON data in Rust: direct deserialization into strongly-typed structs with serde, or using serde_json::Value for dynamic access? Specifically interested in scenarios where performance is critical and every millisecond counts.

helper
join shbcf.ru