summaryrefslogtreecommitdiffstats
path: root/js/rust/src/lib.rs
blob: c16d1e1702f1e25e72891ed36f00099c4671b942 (plain)
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
49
50
51
52
53
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#![crate_name = "js"]
#![crate_type = "rlib"]
#![cfg_attr(feature = "nonzero", feature(nonzero))]
#![allow(
    non_upper_case_globals,
    non_camel_case_types,
    non_snake_case,
    improper_ctypes
)]

#[cfg(feature = "nonzero")]
extern crate core;
#[macro_use]
extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
#[allow(unused_extern_crates)]
extern crate mozjs_sys;
extern crate num_traits;

#[macro_use]
pub mod rust;

pub mod ar;
pub mod conversions;
pub mod error;
pub mod glue;
pub mod heap;
pub mod jsval;
pub mod panic;
pub mod sc;
pub mod typedarray;

pub mod jsapi;
use self::jsapi::root::*;

#[inline(always)]
pub unsafe fn JS_ARGV(_cx: *mut JSContext, vp: *mut JS::Value) -> *mut JS::Value {
    vp.offset(2)
}

impl JS::ObjectOpResult {
    /// Set this ObjectOpResult to true and return true.
    pub fn succeed(&mut self) -> bool {
        self.code_ = JS::ObjectOpResult_SpecialCodes::OkCode as usize;
        true
    }
}