Skip to main content

script_bindings/
lib.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5#![cfg_attr(crown, feature(register_tool))]
6// Register the linter `crown`, which is the Servo-specific linter for the script crate.
7#![cfg_attr(crown, register_tool(crown))]
8
9#[macro_use]
10extern crate js as mozjs;
11#[macro_use]
12extern crate jstraceable_derive;
13#[macro_use]
14extern crate log;
15#[macro_use]
16extern crate malloc_size_of_derive;
17
18pub mod assert;
19pub mod buffer_source;
20pub mod callback;
21pub mod cell;
22mod constant;
23mod constructor;
24pub mod conversions;
25pub mod dom;
26pub mod domstring;
27pub mod error;
28mod finalize;
29mod guard;
30mod import;
31pub mod inheritance;
32mod init;
33pub mod interface;
34pub mod interfaces;
35pub mod iterable;
36pub mod js;
37pub mod like;
38mod lock;
39mod mem;
40mod namespace;
41pub mod num;
42pub mod permanent_root;
43pub mod principals;
44pub mod proxyhandler;
45pub mod realms;
46pub mod record;
47pub mod refcounted;
48pub mod reflector;
49pub mod root;
50pub mod routed_promise;
51pub mod script_runtime;
52pub mod serializable;
53pub mod settings_stack;
54pub mod str;
55pub mod structuredclone;
56pub mod tasks;
57pub mod trace;
58pub mod traits;
59pub mod utils;
60pub mod weakref;
61pub mod wrap;
62
63#[allow(non_snake_case, unsafe_op_in_unsafe_fn)]
64pub mod codegen {
65    pub mod Globals {
66        include!(concat!(env!("OUT_DIR"), "/Globals.rs"));
67    }
68    #[allow(unused_imports, clippy::enum_variant_names)]
69    pub mod InheritTypes {
70        include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs"));
71    }
72    #[allow(clippy::upper_case_acronyms)]
73    pub mod PrototypeList {
74        include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
75    }
76    pub(crate) mod DomTypes {
77        include!(concat!(env!("OUT_DIR"), "/DomTypes.rs"));
78    }
79    #[allow(
80        clippy::extra_unused_type_parameters,
81        clippy::missing_safety_doc,
82        clippy::result_unit_err
83    )]
84    pub mod GenericBindings {
85        include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
86    }
87    #[allow(
88        non_camel_case_types,
89        unused_imports,
90        unused_variables,
91        clippy::large_enum_variant,
92        clippy::upper_case_acronyms,
93        clippy::enum_variant_names
94    )]
95    pub mod GenericUnionTypes {
96        include!(concat!(env!("OUT_DIR"), "/GenericUnionTypes.rs"));
97    }
98    pub mod RegisterBindings {
99        include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
100    }
101}
102
103// These trait exports are public, because they are used in the DOM bindings.
104// Since they are used in derive macros,
105// it is useful that they are accessible at the root of the crate.
106pub(crate) use ::js::gc::Traceable as JSTraceable;
107
108pub use crate::codegen::DomTypes::DomTypes;
109pub(crate) use crate::reflector::{DomObject, MutDomObject, Reflector};
110pub(crate) use crate::trace::CustomTraceable;