1a3621b727
1. inline everything 2. change `check_status` and `type_of` to macro 3. provide #[module_exports] macro 4. remove debug and repr[transparent] for ffi struct
13 lines
322 B
Rust
13 lines
322 B
Rust
use super::check_status;
|
|
use crate::{sys, Result, Value};
|
|
|
|
pub struct JsDate(pub(crate) Value);
|
|
|
|
impl JsDate {
|
|
#[inline]
|
|
pub fn value_of(&self) -> Result<f64> {
|
|
let mut timestamp: f64 = 0.0;
|
|
check_status!(unsafe { sys::napi_get_date_value(self.0.env, self.0.value, &mut timestamp) })?;
|
|
Ok(timestamp)
|
|
}
|
|
}
|