[][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

Trait Implementations

impl Default for Rules[src]

Auto Trait Implementations

impl !RefUnwindSafe for Rules

impl Send for Rules

impl Sync for Rules

impl Unpin for Rules

impl !UnwindSafe for Rules

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.