Record one fewer active user of `id`. Returns the resulting process-local deregistration state.
(&mut self, id: &str)
| 293 | /// |
| 294 | /// Returns the resulting process-local deregistration state. |
| 295 | fn deregister(&mut self, id: &str) -> VfioIdDeregistration { |
| 296 | match self.refcounts.get_mut(id) { |
| 297 | Some(count) if *count > 1 => { |
| 298 | *count -= 1; |
| 299 | VfioIdDeregistration::StillInUse |
| 300 | } |
| 301 | Some(_) => { |
| 302 | self.refcounts.remove(id); |
| 303 | VfioIdDeregistration::LastUser |
| 304 | } |
| 305 | None => VfioIdDeregistration::NotTracked, |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | fn clear(&mut self) { |
| 310 | self.refcounts.clear(); |
no test coverage detected