Struct rustdoc::html::length_limit::HtmlWithLimit [−][src]
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:
- all tags are closed,
- tags are closed in the reverse order of when they were opened (i.e., the correct HTML order),
- no tags are left empty (e.g.,
<em></em>
) due to the length limit being reached, - all text is escaped.
Fields
buf: String
len: usize
limit: usize
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.
Implementations
Create a new buffer, with a limit of length_limit
.
Finish using the buffer and get the written output. This function will close all unclosed tags for you.
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
.
Open an HTML tag.
Note: HTML attributes have not yet been implemented.
This function will panic if called with a non-alphabetic tag_name
.
Write all queued tags and add them to the unclosed_tags
list.
Close all unclosed tags.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for HtmlWithLimit
impl Send for HtmlWithLimit
impl Sync for HtmlWithLimit
impl Unpin for HtmlWithLimit
impl UnwindSafe for HtmlWithLimit
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Layout
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