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

Function decode_delimited

nodedb-codec/src/fsst.rs:290–300  ·  view source on GitHub ↗

Convenience: decode and reassemble with delimiter.

(data: &[u8], delimiter: u8)

Source from the content-addressed store, hash-verified

288
289/// Convenience: decode and reassemble with delimiter.
290pub fn decode_delimited(data: &[u8], delimiter: u8) -> Result<Vec<u8>, CodecError> {
291 let strings = decode(data)?;
292 let mut out = Vec::new();
293 for (i, s) in strings.iter().enumerate() {
294 if i > 0 {
295 out.push(delimiter);
296 }
297 out.extend_from_slice(s);
298 }
299 Ok(out)
300}
301
302// ---------------------------------------------------------------------------
303// Per-string encode / decode

Callers 1

delimited_roundtripFunction · 0.85

Calls 3

decodeFunction · 0.70
iterMethod · 0.45
pushMethod · 0.45

Tested by 1

delimited_roundtripFunction · 0.68