Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #![allow(unused)]
  2. use std::cmp;
  3.  
  4. #[derive(Debug)]
  5. enum Foo {
  6. Bar(Option<u8>),
  7. }
  8.  
  9. fn main() {
  10. let mut foo = Foo::Bar(Some(10));
  11. match &mut foo {
  12. &mut Foo::Bar(ref mut optional) => match optional {
  13. &mut Some(ref mut o) => {
  14. *o = 55;
  15. }
  16. _ => {},
  17. }
  18. _ => {}
  19. };
  20. println!("{:?}", foo);
  21.  
  22.  
  23. let mut foo = Foo::Bar(Some(10));
  24. match &mut foo {
  25. Foo::Bar(optional) => match optional {
  26. Some(o) => {
  27. *o = 55;
  28. }
  29. _ => {},
  30. }
  31. _ => {}
  32. };
  33. println!("{:?}", foo);
  34. }
Add Comment
Please, Sign In to add comment