Struct rstml_component::Sanitized
source · pub struct Sanitized<V>(/* private fields */);
Expand description
A wrapper struct for adding potentially unsanitized HTML content that will be sanitized before rendering.
The Sanitized
struct allows you to include HTML content that might be potentially unsafe,
and ensures that it’s properly sanitized before being rendered within your HTML components.
This is particularly useful when you want to include user-generated content or any content
that might contain unsafe HTML elements or scripts.
Implementations§
source§impl<V> Sanitized<V>
impl<V> Sanitized<V>
sourcepub fn new_with_sanitizer(value: V, sanitizer: &'static SanitizeConfig) -> Self
pub fn new_with_sanitizer(value: V, sanitizer: &'static SanitizeConfig) -> Self
Creates a new Sanitized
instance with the HTML content and a custom sanitizer.
§Arguments
value
: The HTML content to be sanitized as a byte slice.sanitizer
: The custom sanitizer to be used for this specific instance.
§Returns
A Sanitized
instance wrapping the HTML content that will be sanitized using the specified sanitizer.
sourcepub fn with_sanitizer(self, sanitizer: &'static SanitizeConfig) -> Self
pub fn with_sanitizer(self, sanitizer: &'static SanitizeConfig) -> Self
Trait Implementations§
source§impl<V: AsRef<[u8]>> HtmlContent for Sanitized<V>
impl<V: AsRef<[u8]>> HtmlContent for Sanitized<V>
source§fn fmt(self, formatter: &mut HtmlFormatter<'_>) -> Result
fn fmt(self, formatter: &mut HtmlFormatter<'_>) -> Result
Formats the content and writes it to the provided HtmlFormatter. Read more
source§fn write_to(self, buffer: &mut BytesMut) -> Result
fn write_to(self, buffer: &mut BytesMut) -> Result
Writes the formatted content to the provided byte buffer. Read more
Auto Trait Implementations§
impl<V> Freeze for Sanitized<V>where
V: Freeze,
impl<V> !RefUnwindSafe for Sanitized<V>
impl<V> Send for Sanitized<V>where
V: Send,
impl<V> Sync for Sanitized<V>where
V: Sync,
impl<V> Unpin for Sanitized<V>where
V: Unpin,
impl<V> !UnwindSafe for Sanitized<V>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)