This is probably not a high-quality question as I am new to Rust.
I'm working with Rocket. Rocket handlers can return "A value of any type that implements the Responder trait". However, I notice that I can wrap something that implements Responder in any number of Results or Options, and things appear to work. For example:
#[post("/add_data")]
fn add_data() -> std::result::Result<Option<Response<'static>>, Status> {
Ok(Some(Response::new()))
}
Surely there is no code in Rocket to handle all these different combinations of return variants, but with what I know about Rust so far, I didn't expect this to 'just work'. Can someone explain what's happening or how this works?