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 observablearray;
43pub mod permanent_root;
44pub mod principals;
45pub mod proxyhandler;
46pub mod realms;
47pub mod record;
48pub mod refcounted;
49pub mod reflector;
50pub mod root;
51pub mod routed_promise;
52pub mod script_runtime;
53pub mod serializable;
54pub mod settings_stack;
55pub mod str;
56pub mod structuredclone;
57pub mod tasks;
58pub mod trace;
59pub mod traits;
60pub mod utils;
61pub mod weakref;
62pub mod wrap;
63
64#[allow(non_snake_case, unsafe_op_in_unsafe_fn)]
65pub mod codegen {
66    pub mod Globals {
67        include!(concat!(env!("OUT_DIR"), "/Globals.rs"));
68    }
69    #[allow(unused_imports, clippy::enum_variant_names)]
70    pub mod InheritTypes {
71        include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs"));
72    }
73    #[allow(clippy::upper_case_acronyms)]
74    pub mod PrototypeList {
75        include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
76    }
77    pub(crate) mod DomTypes {
78        include!(concat!(env!("OUT_DIR"), "/DomTypes.rs"));
79    }
80    #[allow(
81        clippy::extra_unused_type_parameters,
82        clippy::missing_safety_doc,
83        clippy::result_unit_err
84    )]
85    pub mod GenericBindings {
86        include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
87    }
88    #[allow(
89        non_camel_case_types,
90        unused_imports,
91        unused_variables,
92        clippy::large_enum_variant,
93        clippy::upper_case_acronyms,
94        clippy::enum_variant_names
95    )]
96    pub mod GenericUnionTypes {
97        include!(concat!(env!("OUT_DIR"), "/GenericUnionTypes.rs"));
98    }
99    pub mod RegisterBindings {
100        include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
101    }
102}
103
104// These trait exports are public, because they are used in the DOM bindings.
105// Since they are used in derive macros,
106// it is useful that they are accessible at the root of the crate.
107pub(crate) use ::js::gc::Traceable as JSTraceable;
108
109pub use crate::codegen::DomTypes::DomTypes;
110pub(crate) use crate::reflector::{DomObject, MutDomObject, Reflector};
111pub(crate) use crate::trace::CustomTraceable;