MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / from_bytes

Method from_bytes

lrwn/src/cflist.rs:13–23  ·  view source on GitHub ↗
(b: [u8; 16])

Source from the content-addressed store, hash-verified

11
12impl CFList {
13 pub fn from_bytes(b: [u8; 16]) -> Result<Self> {
14 let mut bb: [u8; 15] = [0; 15];
15 bb.clone_from_slice(&b[..15]);
16
17 // match on CFListType.
18 match b[15] {
19 0x00 => Ok(CFList::Channels(CFListChannels::from_bytes(bb))),
20 0x01 => Ok(CFList::ChannelMask(CFListChannelMasks::from_bytes(bb))),
21 _ => Err(anyhow!("unexpected CFListType")),
22 }
23 }
24
25 pub fn to_bytes(&self) -> Result<[u8; 16]> {
26 let mut b: [u8; 16] = [0; 16];

Callers

nothing calls this directly

Calls 5

CFListChannelsClass · 0.85
CFListChannelMasksClass · 0.85
ChMaskClass · 0.85
pushMethod · 0.80
to_vecMethod · 0.45

Tested by

no test coverage detected