Alternatives for unwrapping OptioN

⚓ Rust    📅 2026-03-21    👤 surdeus    👁️ 2      

surdeus

I am thinking about the case where I have an Option, and I only need to do something in the Some(thing) case. I have used "if let Some(x) = optionvalue {...}; I was reading something else, and realized I could use optionvalue.map({|x| ...}). Is there a reason to prefer one or there other?
Thank you,
Joel

3 posts - 2 participants

Read full topic

🏷️ Rust_feed