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

Function streaming_encoder

nodedb-codec/src/zstd_codec.rs:323–334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

321
322 #[test]
323 fn streaming_encoder() {
324 let parts: Vec<&[u8]> = vec![b"part one ", b"part two ", b"part three"];
325 let full: Vec<u8> = parts.iter().flat_map(|p| p.iter().copied()).collect();
326
327 let mut enc = ZstdEncoder::new();
328 for part in &parts {
329 enc.push(part);
330 }
331 let encoded = enc.finish().unwrap();
332 let decoded = decode(&encoded).unwrap();
333 assert_eq!(decoded, full);
334 }
335
336 #[test]
337 fn truncated_input_errors() {

Callers

nothing calls this directly

Calls 5

collectMethod · 0.80
decodeFunction · 0.70
iterMethod · 0.45
pushMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected