use crocksdb_ffi::DBTableProperties;
use libc::{c_int, c_void};
use std::mem;
use table_properties::TableProperties;
pub trait TableFilter {
fn table_filter(&self, props: &TableProperties) -> bool;
}
pub extern "C" fn table_filter(ctx: *mut c_void, props: *const DBTableProperties) -> c_int {
unsafe {
let filter = &*(ctx as *mut Box<TableFilter>);
filter.table_filter(mem::transmute(&*props)) as c_int
}
}
pub extern "C" fn destroy_table_filter(filter: *mut c_void) {
unsafe {
Box::from_raw(filter as *mut Box<TableFilter>);
}
}