use std::{ffi::c_void, ptr::null_mut};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct Handle(pub *mut c_void);
impl Handle {
pub fn null() -> Self {
Self(null_mut())
}
pub fn as_henv(self) -> HEnv {
HEnv(self.0)
}
pub fn as_hdbc(self) -> HDbc {
HDbc(self.0)
}
pub fn as_hstmt(self) -> HStmt {
HStmt(self.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct HEnv(pub *mut c_void);
impl HEnv {
pub fn null() -> Self {
Self(null_mut())
}
pub fn as_handle(self) -> Handle {
Handle(self.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct HDesc(pub *mut c_void);
impl HDesc {
pub fn null() -> Self {
Self(null_mut())
}
pub fn as_handle(self) -> Handle {
Handle(self.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct HDbc(pub *mut c_void);
impl HDbc {
pub fn as_handle(self) -> Handle {
Handle(self.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct HStmt(pub *mut c_void);
impl HStmt {
pub fn as_handle(self) -> Handle {
Handle(self.0)
}
}
unsafe impl Send for HEnv {}
unsafe impl Send for HDbc {}