#[repr(transparent)]pub struct JsDate(_);
napi-5
only.Expand description
A JavaScript Date object
Implementations
sourceimpl JsDate
impl JsDate
sourcepub const MIN_VALUE: f64
pub const MIN_VALUE: f64
The smallest possible Date value, defined by ECMAScript. See https://www.ecma-international.org/ecma-262/5.1/#sec-15.7.3.3
sourcepub const MAX_VALUE: f64
pub const MAX_VALUE: f64
The largest possible Date value, defined by ECMAScript. See https://www.ecma-international.org/ecma-262/5.1/#sec-15.7.3.2
sourcepub fn new<'a, C: Context<'a>, T: Into<f64>>(
cx: &mut C,
value: T
) -> Result<Handle<'a, JsDate>, DateError>
pub fn new<'a, C: Context<'a>, T: Into<f64>>(
cx: &mut C,
value: T
) -> Result<Handle<'a, JsDate>, DateError>
Creates a new Date. It errors when value
is outside the range of valid JavaScript Date values. When value
is NaN
, the operation will succeed but with an invalid Date
sourcepub fn new_lossy<'a, C: Context<'a>, V: Into<f64>>(
cx: &mut C,
value: V
) -> Handle<'a, JsDate>
pub fn new_lossy<'a, C: Context<'a>, V: Into<f64>>(
cx: &mut C,
value: V
) -> Handle<'a, JsDate>
Creates a new Date with lossy conversion for out of bounds Date values. Out of bounds values will be treated as NaN
Trait Implementations
sourceimpl Object for JsDate
impl Object for JsDate
sourcefn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Option<Handle<'a, V>>>
fn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Option<Handle<'a, V>>>
Gets a property from a JavaScript object that may be undefined
and
attempts to downcast the value if it existed. Read more
sourcefn get_value<'a, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, JsValue>>
fn get_value<'a, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, JsValue>>
sourcefn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, V>>
fn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, V>>
Gets a property from a JavaScript object and attempts to downcast as a specific type.
Equivalent to calling obj.get(&mut cx)?.downcast_or_throw(&mut cx)
. Read more
sourcefn get_own_property_names<'a, C: Context<'a>>(
&self,
cx: &mut C
) -> JsResult<'a, JsArray>
fn get_own_property_names<'a, C: Context<'a>>(
&self,
cx: &mut C
) -> JsResult<'a, JsArray>
napi-6
only.fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>
) -> NeonResult<bool>
fn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Auto Trait Implementations
impl RefUnwindSafe for JsDate
impl !Send for JsDate
impl !Sync for JsDate
impl Unpin for JsDate
impl UnwindSafe for JsDate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more