live_kit.rs

 1use std::ffi::c_void;
 2
 3extern "C" {
 4    fn LKRoomCreate() -> *const c_void;
 5    fn LKRoomDestroy(ptr: *const c_void);
 6}
 7
 8pub struct Room {
 9    native_room: *const c_void,
10}
11
12impl Room {
13    pub fn new() -> Self {
14        Self {
15            native_room: unsafe { LKRoomCreate() },
16        }
17    }
18}
19
20impl Drop for Room {
21    fn drop(&mut self) {
22        unsafe { LKRoomDestroy(self.native_room) }
23    }
24}