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