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

Function raw_to_f64

nodedb-codec/src/pipeline.rs:352–362  ·  view source on GitHub ↗
(data: &[u8])

Source from the content-addressed store, hash-verified

350}
351
352fn 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)]
365mod tests {

Callers 1

decode_f64_pipelineFunction · 0.85

Calls 2

collectMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected