#[derive(Copy, Clone)]
#[repr(C)]
pub union sqlite3_destructor_type {
pub func: unsafe extern "C" fn(context: *mut ::std::os::raw::c_void),
pub sentinel: isize,
}
unsafe impl Send for sqlite3_destructor_type {}
unsafe impl Sync for sqlite3_destructor_type {}
impl sqlite3_destructor_type {
pub const fn new(func: unsafe extern "C" fn(*mut ::std::os::raw::c_void)) -> Self {
sqlite3_destructor_type { func }
}
pub(crate) const fn from_sentinel(sentinel: isize) -> Self {
sqlite3_destructor_type { sentinel }
}
}
impl ::core::fmt::Debug for sqlite3_destructor_type {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let sentinel = unsafe { self.sentinel };
match sentinel {
0 => write!(f, "sqlite3_destructor_type::SQLITE_STATIC"),
-1 => write!(f, "sqlite3_destructor_type::SQLITE_TRANSIENT"),
_ => write!(
f,
"sqlite3_destructor_type::func({:p})",
sentinel as *const ()
),
}
}
}