Struct adblock::filters::network::NetworkFilter

source ·
pub struct NetworkFilter {
    pub mask: NetworkFilterMask,
    pub filter: FilterPart,
    pub opt_domains: Option<Vec<Hash>>,
    pub opt_not_domains: Option<Vec<Hash>>,
    pub modifier_option: Option<String>,
    pub hostname: Option<String>,
    pub raw_line: Option<Box<String>>,
    pub id: Hash,
    pub opt_domains_union: Option<Hash>,
    pub opt_not_domains_union: Option<Hash>,
    /* private fields */
}

Fields§

§mask: NetworkFilterMask§filter: FilterPart§opt_domains: Option<Vec<Hash>>§opt_not_domains: Option<Vec<Hash>>§modifier_option: Option<String>

Used for $redirect, $redirect-rule, $csp, and $removeparam - only one of which is supported per-rule.

§hostname: Option<String>§raw_line: Option<Box<String>>§id: Hash§opt_domains_union: Option<Hash>§opt_not_domains_union: Option<Hash>

Implementations§

source§

impl NetworkFilter

source

pub fn parse( line: &str, debug: bool, _opts: ParseOptions, ) -> Result<Self, NetworkFilterError>

source

pub fn parse_hosts_style( hostname: &str, debug: bool, ) -> Result<Self, NetworkFilterError>

Given a hostname, produces an equivalent filter parsed from the form "||hostname^", to emulate the behavior of hosts-style blocking.

source

pub fn get_id_without_badfilter(&self) -> Hash

source

pub fn get_id(&self) -> Hash

source

pub fn get_tokens(&self) -> Vec<Vec<Hash>>

source

pub fn is_exception(&self) -> bool

source

pub fn is_hostname_anchor(&self) -> bool

source

pub fn is_right_anchor(&self) -> bool

source

pub fn is_left_anchor(&self) -> bool

source

pub fn is_important(&self) -> bool

source

pub fn is_redirect(&self) -> bool

source

pub fn is_removeparam(&self) -> bool

source

pub fn also_block_redirect(&self) -> bool

source

pub fn is_badfilter(&self) -> bool

source

pub fn is_generic_hide(&self) -> bool

source

pub fn is_regex(&self) -> bool

source

pub fn is_complete_regex(&self) -> bool

source

pub fn is_csp(&self) -> bool

Trait Implementations§

source§

impl Clone for NetworkFilter

source§

fn clone(&self) -> NetworkFilter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NetworkFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for NetworkFilter

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for NetworkFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<NetworkFilter> for ParsedFilter

source§

fn from(v: NetworkFilter) -> Self

Converts to this type from the input type.
source§

impl NetworkMatchable for NetworkFilter

source§

fn matches(&self, request: &Request, regex_manager: &mut RegexManager) -> bool

source§

impl PartialEq for NetworkFilter

The ID of a filter is assumed to be correctly calculated for the purposes of this implementation.

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for NetworkFilter

Filters are sorted by ID to preserve a stable ordering of data in the serialized format.

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for NetworkFilter

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,