pub struct HtmlSanitizer {
pub allow_list: AllowList,
/* private fields */
}Expand description
HTML sanitizer with a configurable allow list and URL sanitizer.
Fields§
§allow_list: AllowListImplementations§
Source§impl HtmlSanitizer
impl HtmlSanitizer
Sourcepub fn with_url_sanitizer<F>(self, f: F) -> Self
pub fn with_url_sanitizer<F>(self, f: F) -> Self
Create a new sanitizer with a custom URL sanitizer.
Sourcepub fn set_url_sanitizer<F>(&mut self, f: F)
pub fn set_url_sanitizer<F>(&mut self, f: F)
Set a custom URL sanitizer.
Sourcepub fn new_writer<W: Write>(&self, w: W) -> SanitizeWriter<W> ⓘ
pub fn new_writer<W: Write>(&self, w: W) -> SanitizeWriter<W> ⓘ
Create a new SanitizeWriter wrapping the given writer.
Sourcepub fn sanitize(&self, data: &[u8]) -> Vec<u8> ⓘ
pub fn sanitize(&self, data: &[u8]) -> Vec<u8> ⓘ
Sanitize HTML bytes and return sanitized output.
Sourcepub fn sanitize_string(&self, data: &str) -> String
pub fn sanitize_string(&self, data: &str) -> String
Sanitize an HTML string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HtmlSanitizer
impl !RefUnwindSafe for HtmlSanitizer
impl Send for HtmlSanitizer
impl Sync for HtmlSanitizer
impl Unpin for HtmlSanitizer
impl UnsafeUnpin for HtmlSanitizer
impl !UnwindSafe for HtmlSanitizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more