struct ClassStack {
open_classes: Vec<ClassInfo>,
}Expand description
This represents the stack of HTML elements. For example a macro expansion will contain other elements which might themselves contain other elements (like macros).
This allows to easily handle HTML tags instead of having a more complicated state machine to keep track of which tags are open.
Fields§
§open_classes: Vec<ClassInfo>Implementations§
Source§impl ClassStack
impl ClassStack
fn new() -> Self
fn enter_elem<W: Write>( &mut self, out: &mut W, href_context: &Option<HrefContext<'_, '_>>, new_class: Class, closing_tag: Option<&'static str>, )
Sourcefn exit_elem(&mut self)
fn exit_elem(&mut self)
This sets the pending_exit field to true. Meaning that if we try to push another stack
which is not compatible with this one, it will exit the current one before adding the new
one.
fn last_class(&self) -> Option<Class>
fn last_class_is_open(&self) -> bool
fn close_last_if_needed<W: Write>(&mut self, out: &mut W)
fn push<W: Write>( &mut self, out: &mut W, href_context: &Option<HrefContext<'_, '_>>, class: Option<Class>, text: Cow<'_, str>, needs_escape: bool, )
Sourcefn empty_stack<W: Write>(&mut self, out: &mut W) -> Vec<Class>
fn empty_stack<W: Write>(&mut self, out: &mut W) -> Vec<Class>
This method closes all open tags and returns the list of Class which were not already
closed (ie pending_exit set to true).
It is used when starting a macro expansion: we need to close all HTML tags and then to reopen them inside the newly created expansion HTML tag. Same goes when we close the expansion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClassStack
impl RefUnwindSafe for ClassStack
impl Send for ClassStack
impl Sync for ClassStack
impl Unpin for ClassStack
impl UnwindSafe for ClassStack
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
§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: 24 bytes