This will work in general. One point of improvement: right now, if the request fails, the panic will cause your whole program to crash. You could change your function to return a Result<Html, SomeErrorType> instead, and handle errors more gracefully in the place where your function is called (e.g. ignoring pages that returned an error and continuing with the rest).
Look into anyhow for an easy to use error handling crate, allowing you to return an anyhow::Result<Html>
This will work in general. One point of improvement: right now, if the request fails, the panic will cause your whole program to crash. You could change your function to return a
Result<Html, SomeErrorType>
instead, and handle errors more gracefully in the place where your function is called (e.g. ignoring pages that returned an error and continuing with the rest).Look into anyhow for an easy to use error handling crate, allowing you to return an
anyhow::Result<Html>