MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_sparse_tile

Function read_sparse_tile

nodedb-array/src/segment/reader.rs:108–118  ·  view source on GitHub ↗

Dispatch sparse tile decoding by peeking the tag byte. - Recognized tag (0 or 1): delegate to `decode_sparse_tile`. - Empty payload or unrecognized byte: return a corruption error.

(payload: &[u8])

Source from the content-addressed store, hash-verified

106/// - Recognized tag (0 or 1): delegate to `decode_sparse_tile`.
107/// - Empty payload or unrecognized byte: return a corruption error.
108fn read_sparse_tile(payload: &[u8]) -> ArrayResult<SparseTile> {
109 match peek_tag(payload) {
110 Some(_) => decode_sparse_tile(payload),
111 None => Err(ArrayError::SegmentCorruption {
112 detail: format!(
113 "sparse tile has unrecognized tag byte {:#04x}",
114 payload.first().copied().unwrap_or(0)
115 ),
116 }),
117 }
118}
119
120/// Decoded tile payload.
121#[derive(Debug, Clone, PartialEq)]

Callers 1

read_tileMethod · 0.85

Calls 2

peek_tagFunction · 0.85
decode_sparse_tileFunction · 0.85

Tested by

no test coverage detected