adblock/
lib.rs

1//! `adblock-rust` is the engine powering Brave's native adblocker, available as a library for
2//! anyone to use. It features:
3//!
4//! - Network blocking
5//! - Cosmetic filtering
6//! - Resource replacements
7//! - Hosts syntax
8//! - uBlock Origin syntax extensions
9//! - iOS content-blocking syntax conversion
10//! - Compiling to native code or WASM
11//! - Rust bindings ([crates](https://crates.io/crates/adblock))
12//! - JS bindings ([npm](https://npmjs.com/adblock-rs))
13//! - Community-maintained Python bindings ([pypi](https://pypi.org/project/adblock/))
14//! - High performance!
15//!
16//! Check the [`Engine`] documentation to get started with adblocking.
17
18// Own modules, currently everything is exposed, will need to limit
19pub mod blocker;
20#[cfg(feature = "content-blocking")]
21pub mod content_blocking;
22pub mod cosmetic_filter_cache;
23mod cosmetic_filter_cache_builder;
24mod cosmetic_filter_utils;
25mod data_format;
26pub mod engine;
27pub mod filters;
28mod flatbuffers;
29pub mod lists;
30mod network_filter_list;
31mod optimizer;
32pub mod regex_manager;
33pub mod request;
34pub mod resources;
35pub mod url_parser;
36
37#[doc(hidden)]
38pub mod utils;
39
40#[doc(inline)]
41pub use engine::Engine;
42#[doc(inline)]
43pub use lists::FilterSet;
44
45#[cfg(test)]
46#[path = "../tests/test_utils.rs"]
47mod test_utils;
48
49#[cfg(test)]
50mod sync_tests {
51    #[allow(unused)]
52    fn static_assert_sync<S: Sync>() {
53        let _ = core::marker::PhantomData::<S>;
54    }
55
56    #[test]
57    #[cfg(not(feature = "single-thread"))]
58    fn assert_engine_sync() {
59        static_assert_sync::<crate::engine::Engine>();
60    }
61}