struct TagParser {
tags: Vec<(String, Range<usize>)>,
tag_name: String,
tag_start_pos: usize,
is_closing: bool,
in_attrs: bool,
quote: Option<char>,
quote_pos: Option<usize>,
after_eq: bool,
}Expand description
Parse html tags to ensure they are well-formed
Fields§
§tag_name: StringName of the tag that is being parsed, if we are within a tag.
Since the < and name of a tag must appear on the same line with no whitespace,
if this is the empty string, we are not in a tag.
tag_start_pos: usize§is_closing: bool§in_attrs: booltrue if we are within a tag, but not within its name.
quote: Option<char>If we are in a quoted attribute, what quote char does it use?
This needs to be stored in the struct since HTML5 allows newlines in quoted attrs.
quote_pos: Option<usize>§after_eq: boolImplementations§
Source§impl TagParser
impl TagParser
fn new() -> Self
fn drop_tag( &mut self, range: Range<usize>, f: &impl Fn(String, &Range<usize>, bool), )
Sourcefn handle_lt_in_tag(
&mut self,
range: Range<usize>,
lt_pos: usize,
f: &impl Fn(String, &Range<usize>, bool),
)
fn handle_lt_in_tag( &mut self, range: Range<usize>, lt_pos: usize, f: &impl Fn(String, &Range<usize>, bool), )
Handle a < that appeared while parsing a tag.
fn extract_html_tag( &mut self, text: &str, range: &Range<usize>, start_pos: usize, iter: &mut Peekable<CharIndices<'_>>, f: &impl Fn(String, &Range<usize>, bool), )
fn extract_opening_tag( &mut self, text: &str, range: &Range<usize>, r: Range<usize>, pos: usize, c: char, iter: &mut Peekable<CharIndices<'_>>, f: &impl Fn(String, &Range<usize>, bool), )
Sourcefn tag_parsed(&mut self)
fn tag_parsed(&mut self)
Finished parsing a tag, reset related data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TagParser
impl RefUnwindSafe for TagParser
impl Send for TagParser
impl Sync for TagParser
impl Unpin for TagParser
impl UnwindSafe for TagParser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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: 80 bytes