[][src]Struct sanitize_html::rules::Rules

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

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.

Methods

impl Rules[src]

pub fn new() -> Self[src]

Creates a new rules set.

pub fn allow_comments(self, allow_comments: bool) -> Self[src]

Sets if comments are allowed

pub fn element(self, element: Element) -> Self[src]

Adds a rule for an allowed element

pub fn delete(self, element_name: &str) -> Self[src]

Adds a rule to delete an element

pub fn space(self, element_name: &str) -> Self[src]

Adds a rule to replace an element with space

pub fn rename(self, element_name: &str, to: &str) -> Self[src]

Adds a rule to rename an element

Auto Trait Implementations

impl !Send for Rules

impl Sync for Rules

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]