1use std::{ffi::c_void, ptr::null_mut};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15#[repr(transparent)]
16pub struct Handle(pub *mut c_void);
17
18impl Handle {
19 pub fn null() -> Self {
20 Self(null_mut())
21 }
22
23 pub fn as_henv(self) -> HEnv {
24 HEnv(self.0)
25 }
26
27 pub fn as_hdbc(self) -> HDbc {
28 HDbc(self.0)
29 }
30
31 pub fn as_hstmt(self) -> HStmt {
32 HStmt(self.0)
33 }
34}
35
36#[derive(Debug, Clone, Copy, PartialEq, Eq)]
37#[repr(transparent)]
38pub struct HEnv(pub *mut c_void);
39
40impl HEnv {
41 pub fn null() -> Self {
42 Self(null_mut())
43 }
44
45 pub fn as_handle(self) -> Handle {
46 Handle(self.0)
47 }
48}
49
50#[derive(Debug, Clone, Copy, PartialEq, Eq)]
51#[repr(transparent)]
52pub struct HDesc(pub *mut c_void);
53
54impl HDesc {
55 pub fn null() -> Self {
56 Self(null_mut())
57 }
58}
59
60#[derive(Debug, Clone, Copy, PartialEq, Eq)]
63#[repr(transparent)]
64pub struct HDbc(pub *mut c_void);
65
66impl HDbc {
67 pub fn as_handle(self) -> Handle {
68 Handle(self.0)
69 }
70}
71
72#[derive(Debug, Clone, Copy, PartialEq, Eq)]
73#[repr(transparent)]
74pub struct HStmt(pub *mut c_void);
75
76impl HStmt {
77 pub fn as_handle(self) -> Handle {
78 Handle(self.0)
79 }
80}
81
82unsafe impl Send for HEnv {}
88
89unsafe impl Send for HDbc {}
90
91unsafe impl Send for HStmt {}