(slots: &'a [Option<T>], id: u32, label: &str)
| 17 | } |
| 18 | |
| 19 | pub(crate) fn get_slot<'a, T>(slots: &'a [Option<T>], id: u32, label: &str) -> NetResult<&'a T> { |
| 20 | slots |
| 21 | .get(id as usize) |
| 22 | .and_then(Option::as_ref) |
| 23 | .ok_or_else(|| NetError::new(NetErrorKind::MissingHandle, format!("missing {label} {id}"))) |
| 24 | } |
| 25 | |
| 26 | pub(crate) fn get_slot_mut<'a, T>( |
| 27 | slots: &'a mut [Option<T>], |
no test coverage detected