MCPcopy Create free account
hub / github.com/PerroEngine/Perro / get_slot

Function get_slot

perro_source/api_modules/perro_networking/src/slot.rs:19–24  ·  view source on GitHub ↗
(slots: &'a [Option<T>], id: u32, label: &str)

Source from the content-addressed store, hash-verified

17}
18
19pub(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
26pub(crate) fn get_slot_mut<'a, T>(
27 slots: &'a mut [Option<T>],

Callers 4

tcp_hostMethod · 0.85
tcp_connectionMethod · 0.85
udp_endpointMethod · 0.85
websocket_hostMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected