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

Function encode_coord_axis_rle

nodedb-array/src/codec/coord_rle.rs:53–59  ·  view source on GitHub ↗

Encode a DimDict using RLE if beneficial, falling back to delta otherwise.

(dict: &DimDict, out: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

51
52/// Encode a DimDict using RLE if beneficial, falling back to delta otherwise.
53pub fn encode_coord_axis_rle(dict: &DimDict, out: &mut Vec<u8>) -> ArrayResult<()> {
54 if should_use_rle(&dict.indices) {
55 encode_rle(dict, out)
56 } else {
57 encode_coord_axis(dict, out)
58 }
59}
60
61fn encode_rle(dict: &DimDict, out: &mut Vec<u8>) -> ArrayResult<()> {
62 out.extend_from_slice(&RLE_MARKER.to_le_bytes());

Callers 4

roundtripFunction · 0.85
long_run_uses_rleFunction · 0.85
encode_structuralFunction · 0.85

Calls 3

should_use_rleFunction · 0.85
encode_rleFunction · 0.85
encode_coord_axisFunction · 0.85

Tested by 2

long_run_uses_rleFunction · 0.68