Struct style::properties::declaration_block::DeclarationParserState
source · pub struct DeclarationParserState<'i> {
output_block: PropertyDeclarationBlock,
declarations: SourcePropertyDeclaration,
importance: Importance,
errors: SmallVec<[(ParseError<'i>, &'i str, Option<PropertyId>); 2]>,
last_parsed_property_id: Option<PropertyId>,
}
Expand description
The state needed to parse a declaration block.
It stores declarations in output_block.
Fields§
§output_block: PropertyDeclarationBlock
The output block where results are stored.
declarations: SourcePropertyDeclaration
Declarations from the last declaration parsed. (note that a shorthand might expand to multiple declarations).
importance: Importance
The importance from the last declaration parsed.
errors: SmallVec<[(ParseError<'i>, &'i str, Option<PropertyId>); 2]>
A list of errors that have happened so far. Not all of them might be reported.
last_parsed_property_id: Option<PropertyId>
The last parsed property id, if any.
Implementations§
source§impl<'i> DeclarationParserState<'i>
impl<'i> DeclarationParserState<'i>
sourcepub fn has_parsed_declarations(&self) -> bool
pub fn has_parsed_declarations(&self) -> bool
Returns whether any parsed declarations have been parsed so far.
sourcepub fn take_declarations(&mut self) -> PropertyDeclarationBlock
pub fn take_declarations(&mut self) -> PropertyDeclarationBlock
Takes the parsed declarations.
sourcepub fn parse_value<'t>(
&mut self,
context: &ParserContext<'_>,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
) -> Result<(), ParseError<'i>>
pub fn parse_value<'t>( &mut self, context: &ParserContext<'_>, name: CowRcStr<'i>, input: &mut Parser<'i, 't>, ) -> Result<(), ParseError<'i>>
Parse a single declaration value.
sourcepub fn report_errors_if_needed(
&mut self,
context: &ParserContext<'_>,
selectors: &[SelectorList<SelectorImpl>],
)
pub fn report_errors_if_needed( &mut self, context: &ParserContext<'_>, selectors: &[SelectorList<SelectorImpl>], )
Reports any CSS errors that have ocurred if needed.
fn do_report_css_errors( &mut self, context: &ParserContext<'_>, selectors: &[SelectorList<SelectorImpl>], )
sourcepub fn did_error(
&mut self,
context: &ParserContext<'_>,
error: ParseError<'i>,
slice: &'i str,
)
pub fn did_error( &mut self, context: &ParserContext<'_>, error: ParseError<'i>, slice: &'i str, )
Resets the declaration parser state, and reports the error if needed.
Trait Implementations§
source§impl<'i> Default for DeclarationParserState<'i>
impl<'i> Default for DeclarationParserState<'i>
source§fn default() -> DeclarationParserState<'i>
fn default() -> DeclarationParserState<'i>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'i> Freeze for DeclarationParserState<'i>
impl<'i> RefUnwindSafe for DeclarationParserState<'i>
impl<'i> !Send for DeclarationParserState<'i>
impl<'i> !Sync for DeclarationParserState<'i>
impl<'i> Unpin for DeclarationParserState<'i>
impl<'i> UnwindSafe for DeclarationParserState<'i>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert