rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

options3.rs (411B)


      1 #[derive(Debug)]
      2 struct Point {
      3     x: i32,
      4     y: i32,
      5 }
      6 
      7 fn main() {
      8     let optional_point = Some(Point { x: 100, y: 200 });
      9 
     10     // TODO: Fix the compiler error by adding something to this match statement.
     11     match optional_point {
     12         Some(ref p) => println!("Coordinates are {},{}", p.x, p.y),
     13         _ => panic!("No match!"),
     14     }
     15 
     16     println!("{optional_point:?}"); // Don't change this line.
     17 }