mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-14 10:02:09 -05:00
22 lines
463 B
Rust
22 lines
463 B
Rust
|
use crate::support::Opaque;
|
||
|
use crate::support::UniquePtr;
|
||
|
|
||
|
extern "C" {
|
||
|
fn v8__platform__NewDefaultPlatform() -> *mut Platform;
|
||
|
fn v8__Platform__DELETE(this: *mut Platform);
|
||
|
}
|
||
|
|
||
|
pub fn new_default_platform() -> UniquePtr<Platform> {
|
||
|
unsafe { UniquePtr::from_raw(v8__platform__NewDefaultPlatform()) }
|
||
|
}
|
||
|
|
||
|
#[repr(C)]
|
||
|
#[derive(Debug)]
|
||
|
pub struct Platform(Opaque);
|
||
|
|
||
|
impl Drop for Platform {
|
||
|
fn drop(&mut self) {
|
||
|
unsafe { v8__Platform__DELETE(self) }
|
||
|
}
|
||
|
}
|