pocketsphinx_sys/
hash_table.rs

1use libc::{c_char, c_void, size_t};
2
3#[allow(non_camel_case_types)] pub enum hash_table_t {}
4
5#[repr(C)]
6pub struct hash_entry_t {
7    key: *const c_char,
8    len: size_t,
9    val: *const c_void,
10    next: *const hash_entry_t,
11}
12
13#[repr(C)]
14pub struct hash_iter_t {
15    pub ht: *const hash_table_t,
16    pub ent: *const hash_entry_t,
17    pub idx: size_t,
18}
19
20#[link(name="pocketsphinx")]
21extern {
22
23    pub fn hash_table_iter(h: *const hash_table_t) -> *const hash_iter_t;
24    pub fn hash_table_iter_next(itor: *const hash_iter_t) -> *const hash_iter_t;
25    pub fn hash_table_iter_free(itor: *const hash_iter_t);
26
27}
28
29// Macros
30pub unsafe fn hash_entry_val(e: *const hash_entry_t) -> *const c_void { (*e).val }
31pub unsafe fn hash_entry_key(e: *const hash_entry_t) -> *const c_char { (*e).key }
32pub unsafe fn hash_entry_len(e: *const hash_entry_t) -> size_t { (*e).len }