Decodes a `*.data` file presented in its entirety as `bytes` into a sequence of `Event`s.
(mut bytes: &[u8])
| 194 | /// Decodes a `*.data` file presented in its entirety as `bytes` into a sequence |
| 195 | /// of `Event`s. |
| 196 | pub fn decode(mut bytes: &[u8]) -> impl Iterator<Item = Result<Event<'_>>> + use<'_> { |
| 197 | std::iter::from_fn(move || { |
| 198 | if bytes.is_empty() { |
| 199 | None |
| 200 | } else { |
| 201 | Some(decode_one(&mut bytes)) |
| 202 | } |
| 203 | }) |
| 204 | } |
| 205 | |
| 206 | fn decode_one<'a>(bytes: &mut &'a [u8]) -> Result<Event<'a>> { |
| 207 | match bytes.split_first().unwrap() { |
no test coverage detected