0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-27 01:29:19 -05:00
denoland-rusty-v8/src/value.rs

29 lines
787 B
Rust
Raw Normal View History

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) }
}
}