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

Function encode_delimited

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

Convenience: encode a single contiguous byte buffer that contains multiple strings separated by a delimiter (e.g., newlines for log data).

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

Source from the content-addressed store, hash-verified

282/// Convenience: encode a single contiguous byte buffer that contains
283/// multiple strings separated by a delimiter (e.g., newlines for log data).
284pub fn encode_delimited(data: &[u8], delimiter: u8) -> Vec<u8> {
285 let strings: Vec<&[u8]> = data.split(|&b| b == delimiter).collect();
286 encode(&strings)
287}
288
289/// Convenience: decode and reassemble with delimiter.
290pub fn decode_delimited(data: &[u8], delimiter: u8) -> Result<Vec<u8>, CodecError> {

Callers 1

delimited_roundtripFunction · 0.85

Calls 2

collectMethod · 0.80
encodeFunction · 0.70

Tested by 1

delimited_roundtripFunction · 0.68