(data: &[u8])
| 350 | } |
| 351 | |
| 352 | fn raw_to_f64(data: &[u8]) -> Result<Vec<f64>, CodecError> { |
| 353 | if !data.len().is_multiple_of(8) { |
| 354 | return Err(CodecError::Corrupt { |
| 355 | detail: "f64 data not aligned to 8 bytes".into(), |
| 356 | }); |
| 357 | } |
| 358 | Ok(data |
| 359 | .chunks_exact(8) |
| 360 | .map(|c| f64::from_le_bytes([c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]])) |
| 361 | .collect()) |
| 362 | } |
| 363 | |
| 364 | #[cfg(test)] |
| 365 | mod tests { |
no test coverage detected