Struct rstml_component::HtmlAttributeFormatter

source ·
pub struct HtmlAttributeFormatter<'a> { /* private fields */ }
Expand description

A formatter for serializing HTML attribute values.

Implementations§

source§

impl<'a> HtmlAttributeFormatter<'a>

source

pub fn write_bytes(&mut self, raw: &[u8])

Write raw bytes to the attribute formatter. Note that this method does no sanitization or escaping of the values. If you want the values to be sanitized, use the write method insted.

§Arguments
  • raw: A reference to the raw byte slice that will be written to the buffer.
source

pub fn write(&mut self, value: &[u8])

Writes escaped bytes to the attribute formatter, ensuring valid HTML attribute characters.

This method accepts a reference to a byte slice containing the content to be written to the formatter’s buffer. The provided value is escaped to ensure that it only contains valid HTML attribute characters, preventing any unintentional issues with attribute values. The escaped content is then written to the formatter’s buffer.

§Arguments
  • value: A reference to the raw byte slice containing the content to be escaped and written.
source

pub fn reserve(&mut self, additional: usize)

Reserves space in the buffer for writing additional bytes without re-allocation.

This method ensures that enough space is reserved in the formatter’s buffer to accommodate the writing of additional bytes without needing to reallocate memory. It’s useful to call this method before writing a significant amount of content, as it can help prevent frequent reallocations and improve performance.

§Arguments
  • additional: The number of additional bytes to reserve space for in the buffer.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.