Skip to main content

encode

Function encode 

Source
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

§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");