Crate content_blocker [] [src]

A library for parsing Safari-style content blocking lists and evaluating them against network requests.

Structs

Request

A request that could be filtered.

RuleList

An encapsulation of a list of parsed rules.

Enums

Error

Errors returned when parsing a JSON representation of a list of rules.

LoadType

The type of load that is being initiated.

Reaction

The action to take for the provided request.

ResourceType

The type of resource being requested.

Functions

parse_list

Parse a string containing a JSON representation of a content blocker list. Returns a vector of parsed rules, or an error representing the nature of the invalid input. Any rules missing required fields will be silently ignored.

process_rules_for_request

Attempt to match the given request against the provided rules. Returns a list of actions to take in response; an empty list means that the request should continue unmodified.