Encode a DimDict using RLE if beneficial, falling back to delta otherwise.
(dict: &DimDict, out: &mut Vec<u8>)
| 51 | |
| 52 | /// Encode a DimDict using RLE if beneficial, falling back to delta otherwise. |
| 53 | pub 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 | |
| 61 | fn encode_rle(dict: &DimDict, out: &mut Vec<u8>) -> ArrayResult<()> { |
| 62 | out.extend_from_slice(&RLE_MARKER.to_le_bytes()); |