#![allow(unused_extern_crates)]
#![cfg_attr(feature = "crown", feature(register_tool))]
#![cfg_attr(feature = "crown", register_tool(crown))]
#![cfg_attr(feature = "oom_with_hook", feature(alloc_error_hook))]
extern crate encoding_c;
extern crate encoding_c_mem;
#[cfg(feature = "intl")]
extern crate icu_capi;
#[cfg(feature = "libz-rs")]
extern crate libz_rs_sys;
#[cfg(feature = "libz-sys")]
extern crate libz_sys;
mod jsimpls;
pub mod glue;
pub mod jsgc;
pub mod jsid;
pub mod jsval;
pub mod trace;
pub use crate::generated::root as jsapi;
#[doc(hidden)]
#[allow(dead_code)]
mod generated {
#![allow(unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/build/jsapi.rs"));
}
#[no_mangle]
pub extern "C" fn install_rust_hooks() {
#[cfg(feature = "oom_with_hook")]
oom_hook::install();
}
#[cfg(feature = "oom_with_hook")]
mod oom_hook {
use std::alloc::{set_alloc_error_hook, Layout};
extern "C" {
pub fn RustHandleOOM(size: usize) -> !;
}
pub fn hook(layout: Layout) {
unsafe {
RustHandleOOM(layout.size());
}
}
pub fn install() {
set_alloc_error_hook(hook);
}
}