Record one active user of `id`. Returns the resulting process-local registration state.
(&mut self, id: &str)
| 280 | /// |
| 281 | /// Returns the resulting process-local registration state. |
| 282 | fn register(&mut self, id: &str) -> VfioIdRegistration { |
| 283 | let count = self.refcounts.entry(id.to_string()).or_insert(0); |
| 284 | *count += 1; |
| 285 | if *count == 1 { |
| 286 | VfioIdRegistration::FirstUser |
| 287 | } else { |
| 288 | VfioIdRegistration::AlreadyTracked |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /// Record one fewer active user of `id`. |
| 293 | /// |
no outgoing calls
no test coverage detected