mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-26 09:13:46 -05:00
28 lines
787 B
Rust
28 lines
787 B
Rust
use crate::support;
|
|
|
|
extern "C" {
|
|
fn v8__Value__IsUndefined(this: &Value) -> bool;
|
|
fn v8__Value__IsNull(this: &Value) -> bool;
|
|
fn v8__Value__IsNullOrUndefined(this: &Value) -> bool;
|
|
}
|
|
|
|
#[repr(C)]
|
|
pub struct Value(support::Opaque);
|
|
|
|
impl Value {
|
|
/// Returns true if this value is the undefined value. See ECMA-262 4.3.10.
|
|
pub fn is_undefined(&self) -> bool {
|
|
unsafe { v8__Value__IsUndefined(self) }
|
|
}
|
|
|
|
/// Returns true if this value is the null value. See ECMA-262 4.3.11.
|
|
pub fn is_null(&self) -> bool {
|
|
unsafe { v8__Value__IsNull(self) }
|
|
}
|
|
|
|
/// Returns true if this value is either the null or the undefined value.
|
|
/// See ECMA-262 4.3.11. and 4.3.12
|
|
pub fn is_null_or_undefined(&self) -> bool {
|
|
unsafe { v8__Value__IsNullOrUndefined(self) }
|
|
}
|
|
}
|