Function rscache::codec::decode [−][src]
pub fn decode(buffer: &[u8]) -> Result<Vec<u8>>
Expand description
Decodes the buffer.
The following process takes place when decoding:
- Read the first byte to determine which compression type should be used to decompress.
- Read the length of the rest of the buffer.
- Decompress the remaining bytes.
Errors
Returns an error if the remaining bytes couldn’t be decompressed.
Examples
use rscache::codec::Compression;
let buffer = cache.read(2, 10)?;
let decoded_buffer = rscache::codec::decode(&buffer)?;