Struct sanitize_html::rules::Rules

source ·
pub struct Rules {
    pub allow_comments: bool,
    pub allowed_elements: HashMap<String, Element>,
    pub delete_elements: HashSet<String>,
    pub space_elements: HashSet<String>,
    pub rename_elements: HashMap<String, String>,
}
Expand description

structure to describe sanitization rules

Fields

allow_comments: bool

Determines if comments are kept of stripped out of a document.

allowed_elements: HashMap<String, Element>

Allowed elements.

delete_elements: HashSet<String>

Elements which will be removed together with their children.

space_elements: HashSet<String>

Elements which will be replaced by spaces (Their children will be processed recursively).

rename_elements: HashMap<String, String>

Elements which will be renamed.

Implementations

Creates a new rules set.

Sets if comments are allowed

Adds a rule for an allowed element

Adds a rule to delete an element

Adds a rule to replace an element with space

Adds a rule to rename an element

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.