RuleSets

Struct RuleSets 

Source
pub struct RuleSets(pub BTreeMap<String, Vec<Rc<RuleSet>>>);
Expand description

RuleSets consists of a tuple btreemap of rulesets, keyed by some target FQDN

Tuple Fields§

§0: BTreeMap<String, Vec<Rc<RuleSet>>>

Implementations§

Source§

impl RuleSets

Source

pub fn new() -> RuleSets

Returns a new rulesets struct

Source

pub fn count_targets(&self) -> usize

Returns the number of targets in the current RuleSets struct as a usize

Source

pub fn clear(&mut self)

Clears the ruleset btreemap of all values

Source

pub fn add_all_from_json_string( &mut self, json_string: &String, enable_mixed_rulesets: &bool, ruleset_active_states: &HashMap<String, bool>, scope: &Option<String>, )

Construct and add new rulesets given a json string of values

§Arguments
  • json_string - A json string representing the rulesets to add
  • enable_mixed_rulesets - A bool indicating whether rulesets which trigger mixed content blocking should be enabled
  • rule_active_states - A HashMap which lets us know whether rulesets have been disabled or enabled
  • scope - An optional string which indicates the scope of the current batch of rulesets being added (see the ruleset update channels documentation)
Source

pub fn add_all_from_serde_value( &mut self, rulesets: Value, enable_mixed_rulesets: &bool, ruleset_active_states: &HashMap<String, bool>, scope: &Option<String>, )

Source

pub fn potentially_applicable(&self, host: &String) -> Vec<Rc<RuleSet>>

Return a vector of rulesets that apply to the given host

§Arguments
  • host - A string which indicates the host to search for potentially applicable rulesets

Trait Implementations§

Source§

impl Debug for RuleSets

Source§

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

Formats the value using the given formatter. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.