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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Facilities for working with primitive values.

use raw::{Local, Isolate};

extern "C" {

    /// Mutates the `out` argument provided to refer to the `v8::Undefined` object.
    #[link_name = "Neon_Primitive_Undefined"]
    pub fn undefined(out: &mut Local);

    /// Mutates the `out` argument provided to refer to the `v8::Null` object.
    #[link_name = "Neon_Primitive_Null"]
    pub fn null(out: &mut Local);

    /// Mutates the `out` argument provided to refer to the `v8::Boolean` object.
    #[link_name = "Neon_Primitive_Boolean"]
    pub fn boolean(out: &mut Local, b: bool);

    /// Gets the underlying value of a `v8::Boolean` object.
    #[link_name = "Neon_Primitive_BooleanValue"]
    pub fn boolean_value(p: Local) -> bool;

    // DEPRECATE(0.2)
    /// Mutates the `out` argument provided to refer to a newly created `v8::Integer` object.
    #[link_name = "Neon_Primitive_Integer"]
    pub fn integer(out: &mut Local, isolate: *mut Isolate, x: i32);

    /// Indicates if the value is a 32-bit unsigned integer.
    #[link_name = "Neon_Primitive_IsUint32"]
    pub fn is_u32(p: Local) -> bool;

    /// Indicates if the value is a 32-bit signed integer.
    #[link_name = "Neon_Primitive_IsInt32"]
    pub fn is_i32(p: Local) -> bool;

    // DEPRECATE(0.2)
    /// Gets the underlying value of a `v8::Integer` object.
    #[link_name = "Neon_Primitive_IntegerValue"]
    pub fn integer_value(p: Local) -> i64;

    /// Mutates the `out` argument provided to refer to a newly created `v8::Number` object.
    #[link_name = "Neon_Primitive_Number"]
    pub fn number(out: &mut Local, isolate: *mut Isolate, v: f64);

    /// Gets the underlying value of a `v8::Number` object.
    #[link_name = "Neon_Primitive_NumberValue"]
    pub fn number_value(p: Local) -> f64;
}