Crates.io | adblock |
lib.rs | adblock |
version | 0.9.2 |
source | src |
created_at | 2019-05-02 16:31:26.158817 |
updated_at | 2024-10-13 18:43:07.486201 |
description | Native Rust module for Adblock Plus syntax (e.g. EasyList, EasyPrivacy) filter parsing and matching. |
homepage | |
repository | https://github.com/brave/adblock-rust/ |
max_upload_size | |
id | 131567 |
size | 821,295 |
adblock-rust
is the engine powering Brave's native adblocker, available as a library for anyone to use. It features:
adblock-rust
is used in several projects, including browsers, research tools, and proxies.
It may be a good fit for yours, too!
See docs.rs for detailed API documentation.
Also check the Rust example or the NodeJS example.
The following cargo
features can be used to tweak adblock-rust
to best fit your use-case.
css-validation
)When parsing cosmetic filter rules, it's possible to include a built-in implementation of CSS validation (through the selectors and cssparser crates) by enabling the css-validation
feature. This will cause adblock-rust
to reject cosmetic filter rules with invalid CSS syntax.
content-blocking
)Enabling the content-blocking
feature gives adblock-rust
support for conversion of standard ABP-style rules into Apple's content-blocking format, which can be exported for use on iOS and macOS platforms.
embedded-domain-resolver
)By default, adblock-rust
ships with a built-in domain resolution implementation (through the addr crate) that will generally suffice for standalone use-cases. For more advanced use-cases, disabling the embedded-domain-resolver
feature will allow adblock-rust
to use an external domain resolution implementation instead. This is extremely useful to reduce binary bloat and improve consistency when embedding adblock-rust
within a browser.
resource-assembler
)adblock-rust
uses uBlock Origin-compatible resources for scriptlet injection and redirect rules.
The resource-assembler
feature allows adblock-rust
to parse these resources directly from the file formats used by the uBlock Origin repository.
object-pooling
, unsync-regex-caching
)The object-pooling
and unsync-regex-caching
features enable optimizations for rule matching speed and the amount of memory used by the engine.
These features can be disabled to make the engine Send + Sync
, although it is recommended to only access the engine on a single thread to maintain optimal performance.