Number of blocks in an encoded FastLanes stream.
(data: &[u8])
| 159 | |
| 160 | /// Number of blocks in an encoded FastLanes stream. |
| 161 | pub fn block_count(data: &[u8]) -> Result<usize, CodecError> { |
| 162 | if data.len() < GLOBAL_HEADER_SIZE { |
| 163 | return Err(CodecError::Truncated { |
| 164 | expected: GLOBAL_HEADER_SIZE, |
| 165 | actual: data.len(), |
| 166 | }); |
| 167 | } |
| 168 | Ok(u16::from_le_bytes([data[4], data[5]]) as usize) |
| 169 | } |
| 170 | |
| 171 | /// Decode a single block by index without decoding the entire stream. |
| 172 | /// |