1use std::ffi::CString;
2use std::ptr;
3
4use sys::*;
5
6pub struct Device {
7 pub(crate) handle: RTCDevice,
8}
9
10impl Device {
11 pub fn new() -> Device {
12 Device {
13 handle: unsafe { rtcNewDevice(ptr::null()) },
14 }
15 }
16 pub fn debug() -> Device {
17 let cfg = CString::new("verbose=4").unwrap();
18 Device {
19 handle: unsafe { rtcNewDevice(cfg.as_ptr()) },
20 }
21 }
22 }
25
26impl Drop for Device {
27 fn drop(&mut self) {
28 unsafe {
29 rtcReleaseDevice(self.handle);
30 }
31 }
32}
33
34unsafe impl Sync for Device {}
35