HtmlWithLimit in rustdoc::html::length_limit - Rust (original) (raw)

Struct HtmlWithLimit

Source

pub(super) struct HtmlWithLimit {
    buf: String,
    len: usize,
    limit: usize,
    queued_tags: Vec<&'static str>,
    unclosed_tags: Vec<&'static str>,
}

Expand description

A buffer that allows generating HTML with a length limit.

This buffer ensures that:

A list of tags that have been requested to be opened via Self::open_tag()but have not actually been pushed to buf yet. This ensures that tags are not left empty (e.g., <em></em>) due to the length limit being reached.

A list of all tags that have been opened but not yet closed.

Source§

Source

Create a new buffer, with a limit of length_limit.

Source

Finish using the buffer and get the written output. This function will close all unclosed tags for you.

Source

Write some plain text to the buffer, escaping as needed.

This function skips writing the text if the length limit was reached and returns ControlFlow::Break.

Source

Open an HTML tag.

Note: HTML attributes have not yet been implemented. This function will panic if called with a non-alphabetic tag_name.

Source

Close the most recently opened HTML tag.

Source

Write all queued tags and add them to the unclosed_tags list.

Source

Close all unclosed tags.

§

§

§

§

§

§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 88 bytes