[−][src]Struct adblock::filters::cosmetic::CosmeticFilter
Struct representing a parsed cosmetic filter rule.
Fields
entities: Option<Vec<Hash>>
hostnames: Option<Vec<Hash>>
mask: CosmeticFilterMask
not_entities: Option<Vec<Hash>>
not_hostnames: Option<Vec<Hash>>
raw_line: Option<String>
selector: String
key: Option<String>
style: Option<String>
Implementations
impl CosmeticFilter
[src]
pub fn locations_before_sharp(
line: &str,
sharp_index: usize
) -> impl Iterator<Item = (CosmeticFilterLocationType, &str)>
[src]
line: &str,
sharp_index: usize
) -> impl Iterator<Item = (CosmeticFilterLocationType, &str)>
pub fn parse(
line: &str,
debug: bool
) -> Result<CosmeticFilter, CosmeticFilterError>
[src]
line: &str,
debug: bool
) -> Result<CosmeticFilter, CosmeticFilterError>
Parse the rule in line
into a CosmeticFilter
. If debug
is true, the original rule
will be reported in the resulting CosmeticFilter
struct as well.
pub fn has_hostname_constraint(&self) -> bool
[src]
Any cosmetic filter rule that specifies (possibly negated) hostnames or entities has a hostname constraint.
pub fn hidden_generic_rule(&self) -> Option<CosmeticFilter>
[src]
In general, adding a hostname or entity to a rule increases the number of situations in which it applies. However, if a specific rule only has negated hostnames or entities, it technically should apply to any hostname which does not match a negation.
See: https://github.com/chrisaljoudi/uBlock/issues/145
To account for this inconsistency, this method will generate and return the corresponding 'hidden' generic rule if one applies.
Note that this behavior is not applied to script injections or custom style rules.
Trait Implementations
impl Clone for CosmeticFilter
[src]
fn clone(&self) -> CosmeticFilter
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CosmeticFilter
[src]
impl<'de> Deserialize<'de> for CosmeticFilter
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'_> From<&'_ CosmeticFilter> for SpecificFilterType
[src]
This implementation assumes the given rule has hostname or entity constraints, and that the appropriate 'hidden' generic rule has already been applied externally if necessary.
fn from(rule: &CosmeticFilter) -> Self
[src]
impl From<CosmeticFilter> for ParsedFilter
[src]
fn from(v: CosmeticFilter) -> Self
[src]
impl Serialize for CosmeticFilter
[src]
Auto Trait Implementations
impl RefUnwindSafe for CosmeticFilter
impl Send for CosmeticFilter
impl Sync for CosmeticFilter
impl Unpin for CosmeticFilter
impl UnwindSafe for CosmeticFilter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,