pub fn encode(data: &[u8], comp_type: u32) -> Result<Vec<u8>, DvplError>Expand description
Encode raw data into a DVPL blob: compress, compute CRC32, append footer.
See the module-level docs for the footer layout.
§Arguments
data- Raw bytes to encode.comp_type- One ofCOMP_NONE,COMP_LZ4, orCOMP_LZ4_HC.
§Errors
Returns DvplError::UnknownCompression if comp_type is not recognized.
§Examples
use dvpl_engine::COMP_LZ4_HC;
use dvpl_engine::encode;
let blob = encode(b"hello", COMP_LZ4_HC).unwrap();
assert_eq!(&blob[blob.len() - 4..], b"DVPL");