I am having a hard time how to use map as shown in this:
Why does Rust need the `if let` syntax?
Is there a way to shorten this code using map? I need the else part to work too but not sure how to do it with map?
fn token(&self) -> Option<String> {
if let Some(token) = actix_web::HttpMessage::cookie(self,"token") {
Some(token.value().to_owned())
} else {
None
//Some("NO COOKIE!!!!".to_owned())
}
}