1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::Context;
use crate::Date;
use crate::HandleScope;
use crate::Local;
extern "C" {
fn v8__Date__New(context: *const Context, value: f64) -> *const Date;
fn v8__Date__ValueOf(this: *const Date) -> f64;
}
impl Date {
#[inline(always)]
pub fn new<'s>(
scope: &mut HandleScope<'s>,
value: f64,
) -> Option<Local<'s, Date>> {
unsafe {
scope.cast_local(|sd| v8__Date__New(sd.get_current_context(), value))
}
}
#[inline(always)]
pub fn value_of(&self) -> f64 {
unsafe { v8__Date__ValueOf(self) }
}
}