Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. fn main() {
  2. let deep_wrapped: Option<Option<Option<String>>> = Some(Some(Some("hello".to_string())));
  3.  
  4. // let unwrapped1 = deep_wrapped.expect("None in depth 1!");
  5. // let unwrapped2 = unwrapped1.expect("None in depth 2!");
  6. // let unwrapped3 = unwrapped2.expect("None in depth 3!");
  7.  
  8. // println!("{}", unwrapped3);
  9.  
  10. if let Some(unwrapped1) = deep_wrapped {
  11. if let Some(unwrapped2) = unwrapped1 {
  12. if let Some(unwrapped3) = unwrapped2 {
  13. println!("{}", unwrapped3);
  14. }
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement