pub unsafe fn decompress_bytes<T: Copy>(src: &[u8]) -> Result<Vec<T>>Expand description
Decompress arbitrary data into a newly allocated Vec
Use this method when decompressing serialized data from disk, or receiving it over the network.
§Safety
This function is unsafe because it can transmute data into an arbitrary
type. That can cause memory errors if the type parameter contains
references or pointers. To use safely, the caller must ensure that the
serialized data really was created by Blosc, with the correct type.
This function is also unsafe if the compressed buffer is untrusted. See Blosc issue #229.
§Example
let serialized: Vec<u8> = vec![2, 1, 19, 4, 12, 0, 0, 0, 12, 0, 0, 0,
28, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0];
let decompressed = unsafe{ decompress_bytes(&serialized[..])}.unwrap();
assert_eq!(&[1, 2, 3], &decompressed[..]);