/** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */ impl MyCalendar {
fnnew() -> Self { MyCalendar { events: vec![] } }
fnbook(&mutself, start: i32, end: i32) -> bool { ifself.events.len() == 0 { self.events.push(vec![start, end]); returntrue; } for e in &self.events { let (ss, ee) = (e[0], e[1]); if start < ee && end > ss { returnfalse; } }