Struct EndTag

Source
pub struct EndTag<'i> { /* private fields */ }
Expand description

An HTML end tag rewritable unit.

Exposes API for examination and modification of a parsed HTML end tag.

Implementations§

Source§

impl<'i> EndTag<'i>

Source

pub fn name(&self) -> String

Returns the name of the tag, always ASCII lowercase.

Source

pub fn name_preserve_case(&self) -> String

Returns the name of the tag, preserving its case.

Source

pub fn set_name_str(&mut self, name: String)

Sets the name of the tag only. To rename the element, prefer Element::set_tag_name().

The name will be converted to the document’s encoding.

The name must have a valid syntax, and the closing tag must be valid in its context. The parser will not take the new name into account, so if the new tag alters the structure of the document, the rest of the generated document will be parsed differently than during rewriting.

Source

pub fn before(&mut self, content: &str, content_type: ContentType)

Inserts content before the end tag.

Consequent calls to the method append content to the previously inserted content.

Source

pub fn after(&mut self, content: &str, content_type: ContentType)

Inserts content after the end tag.

Consequent calls to the method prepend content to the previously inserted content.

Source

pub fn replace(&mut self, content: &str, content_type: ContentType)

Replaces the end tag with content.

Consequent calls to the method overwrite previous replacement content.

Source

pub fn streaming_before( &mut self, string_writer: Box<dyn StreamingHandler + Send>, )

Inserts content from a StreamingHandler before the end tag.

Consequent calls to the method append to the previously inserted content.

Use the streaming! macro to make a StreamingHandler from a closure.

Source

pub fn streaming_after( &mut self, string_writer: Box<dyn StreamingHandler + Send>, )

Inserts content from a StreamingHandler after the end tag.

Consequent calls to the method prepend to the previously inserted content.

Use the streaming! macro to make a StreamingHandler from a closure.

Source

pub fn streaming_replace( &mut self, string_writer: Box<dyn StreamingHandler + Send>, )

Replaces the end tag with content from a StreamingHandler.

Consequent calls to the method overwrite previous replacement content.

Use the streaming! macro to make a StreamingHandler from a closure.

Source

pub fn remove(&mut self)

Removes the end tag.

Source

pub fn removed(&self) -> bool

Returns true if the end tag has been replaced or removed.

Source

pub fn source_location(&self) -> SourceLocation

Position of this tag in the source document, before any rewriting

Trait Implementations§

Source§

impl Debug for EndTag<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'i> Freeze for EndTag<'i>

§

impl<'i> RefUnwindSafe for EndTag<'i>

§

impl<'i> Send for EndTag<'i>

§

impl<'i> Sync for EndTag<'i>

§

impl<'i> Unpin for EndTag<'i>

§

impl<'i> UnwindSafe for EndTag<'i>

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

Source§

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

Source§

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.