Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused)]
- #[derive(Debug)]
- enum Foo {
- Bar(Option<u8>),
- }
- fn main() {
- let mut foo = Foo::Bar(Some(10));
- match &mut foo {
- &mut Foo::Bar(ref mut optional) => match optional {
- &mut Some(ref mut o) => {
- *o = 55;
- }
- _ => {},
- }
- _ => {}
- };
- println!("{:?}", foo);
- let mut foo = Foo::Bar(Some(10));
- match &mut foo {
- Foo::Bar(optional) => match optional {
- Some(o) => {
- *o = 55;
- }
- _ => {},
- }
- _ => {}
- };
- println!("{:?}", foo);
- }
Add Comment
Please, Sign In to add comment