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;
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 callback;
20pub mod cell;
21mod constant;
22mod constructor;
23pub mod conversions;
24pub mod dom;
25pub mod domstring;
26pub mod error;
27mod finalize;
28mod guard;
29mod import;
30pub mod inheritance;
31mod init;
32pub mod interface;
33pub mod interfaces;
34pub mod iterable;
35pub mod like;
36mod lock;
37mod mem;
38mod namespace;
39pub mod num;
40pub mod principals;
41pub mod proxyhandler;
42pub mod realms;
43pub mod record;
44pub mod reflector;
45pub mod root;
46pub mod script_runtime;
47pub mod settings_stack;
48pub mod str;
49pub mod structuredclone;
50pub mod trace;
51pub mod utils;
52pub mod weakref;
53pub mod wrap;
54
55#[allow(non_snake_case, unsafe_op_in_unsafe_fn)]
56pub mod codegen {
57    pub mod Globals {
58        include!(concat!(env!("OUT_DIR"), "/Globals.rs"));
59    }
60    #[allow(unused_imports, clippy::enum_variant_names)]
61    pub mod InheritTypes {
62        include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs"));
63    }
64    #[allow(clippy::upper_case_acronyms)]
65    pub mod PrototypeList {
66        include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
67    }
68    pub(crate) mod DomTypes {
69        include!(concat!(env!("OUT_DIR"), "/DomTypes.rs"));
70    }
71    #[allow(
72        clippy::extra_unused_type_parameters,
73        clippy::missing_safety_doc,
74        clippy::result_unit_err
75    )]
76    pub mod GenericBindings {
77        include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
78    }
79    #[allow(
80        non_camel_case_types,
81        unused_imports,
82        unused_variables,
83        clippy::large_enum_variant,
84        clippy::upper_case_acronyms,
85        clippy::enum_variant_names
86    )]
87    pub mod GenericUnionTypes {
88        include!(concat!(env!("OUT_DIR"), "/GenericUnionTypes.rs"));
89    }
90    pub mod RegisterBindings {
91        include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
92    }
93}
94
95// These trait exports are public, because they are used in the DOM bindings.
96// Since they are used in derive macros,
97// it is useful that they are accessible at the root of the crate.
98pub(crate) use js::gc::Traceable as JSTraceable;
99
100pub use crate::codegen::DomTypes::DomTypes;
101pub(crate) use crate::reflector::{DomObject, MutDomObject, Reflector};
102pub(crate) use crate::trace::CustomTraceable;