use std::pin::Pin;
use cxx::{Exception, UniquePtr};
use crate::build::Builder;
use crate::encoders::*;
use crate::hashing::Hash;
type Result<T> = std::result::Result<T, Exception>;
include!(concat!(env!("OUT_DIR"), "/backends_codegen.rs.inc"));
pub(crate) trait BackendPhf: Sized + cxx::memory::UniquePtrTarget {
type Hash: Hash;
type Encoder: Encoder;
type Builder: Builder<Hash = Self::Hash>;
fn new() -> UniquePtr<Self>;
fn position(&self, hash: Self::Hash) -> u64;
fn num_bits(&self) -> usize;
fn num_keys(&self) -> u64;
fn table_size(&self) -> u64;
fn seed(&self) -> u64;
fn build(
self: Pin<&mut Self>,
builder: &Self::Builder,
config: &ffi::build_configuration,
) -> Result<f64>;
unsafe fn save(self: Pin<&mut Self>, filename: *const i8) -> Result<usize>;
unsafe fn load(self: Pin<&mut Self>, filename: *const i8) -> Result<usize>;
}