Expand description
CSS string parser (tokenizer, declaration parser, shorthand expansion). High-level types and functions related to CSS parsing.
Main entry point: [new_from_str] parses a CSS string into a [Css] value
plus a list of recoverable warnings. Errors are downgraded to warnings so
that partially-valid CSS still produces usable output.
Supports @media, @theme, @os, @lang, and @container
at-rules, CSS nesting, CSS variables (var(--name, default)), and
comma-separated selector lists. Tokenisation is delegated to azul_simplecss.
Most error types come in borrowed/owned pairs (e.g. CssParseError<'a> /
CssParseErrorOwned) so they can be returned across the FFI boundary.
Re-exports§
pub use crate::props::property::CssParsingError;
Structs§
- CssParse
Error - Error that can happen during the parsing of a CSS value
- CssParse
Error Owned - Owned version of CssParseError, without references.
- CssParse
Warn Msg - CssParse
Warn MsgOwned - Owned version of CssParseWarnMsg, where warning is the owned type.
- CssSyntax
Error Pos - FFI-safe position of a CSS syntax error.
- CssSyntax
Invalid Advance - FFI-safe wrapper for invalid advance details in CSS syntax errors.
- Error
Location - Error
Location Range - FFI-safe replacement for
(ErrorLocation, ErrorLocation)tuple. Represents a range (start..end) in the source text. - Unknown
Property KeyError - Wrapper for UnknownPropertyKey error.
- Unknown
Selector Error - Wrapper for UnknownSelector error.
- Unparsed
CssRule Block - Unparsed
CssRule Block Owned - Owned version of UnparsedCssRuleBlock, with BTreeMap of Strings.
- VarOn
Shorthand Property Error - Wrapper for VarOnShorthandProperty error.
Enums§
- CssParse
Error Inner - CssParse
Error Inner Owned - CssParse
Warn MsgInner - CssParse
Warn MsgInner Owned - CssPath
Parse Error - CssPath
Parse Error Owned - CssPseudo
Selector Parse Error - CssPseudo
Selector Parse Error Owned - CssSyntax
Error - FFI-safe CSS syntax error type, mirrors azul_simplecss::Error.
- Dynamic
CssParse Error - Error that can happen during
css_parser::parse_key_value_pair - Dynamic
CssParse Error Owned - Simplecss
Error - List of all supported errors.
Functions§
- new_
from_ str - Parses a CSS string into a
Cssvalue and a list of recoverable warnings. - parse_
attribute_ selector - Parses the inner content of an attribute selector token (the text between
[and]). - parse_
css_ declaration - Parses a single CSS key-value declaration, appending results to
declarations. - parse_
css_ path - Parses a CSS path from a string (only the path,.no commas allowed)
- pseudo_
selector_ from_ str - “selector” contains the actual selector such as “nth-child” while “value” contains an optional value - for example “nth-child(3)” would be: selector: “nth-child”, value: “3”.