1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::mem;
use rocks_sys as ll;
use crate::options::CompressionType;
pub fn get_supported_compressions() -> Vec<CompressionType> {
unsafe {
let mut n = 0;
let ptr = ll::rocks_get_supported_compressions(&mut n);
let mut ret = Vec::with_capacity(n);
for i in 0..n {
ret.push(mem::transmute(*ptr.offset(i as isize)));
}
ll::rocks_get_supported_compressions_destroy(ptr);
ret
}
}
#[test]
fn test_compression_types() {
let types = get_supported_compressions();
assert!(types.len() >= 1);
assert!(types.contains(&CompressionType::NoCompression));
}