[][src]Module azulc::xml

XML-based DOM serialization and XML-to-Rust compiler implementation

Structs

BodyRenderer

Render for a body component

ComponentArguments

A component can take various arguments (to pass down to its children), which are then later compiled into Rust function arguments - for example

DivRenderer

Render for a div component

DomXml

Wrapper for the XML parser - necessary to easily create a Dom from XML without putting an XML solver into azul-core.

DynamicXmlComponent

Component that was created from a XML node (instead of being registered from Rust code). Necessary to

TextPos

Position in text.

TextRenderer

Render for a p component

XmlComponentMap

Holds all XML components - builtin components

XmlNode

Represents one XML node tag

Enums

CompileError

Error that can happen from the translation from XML code to Rust code - stringified, since it is only used for printing and is not exposed in the public API

ComponentParseError
DynamicItem

Item of a split string - either a variable name or a string

LoadStyleFileError

Error that can happen while a CSS file is being loaded from an XML file

RenderDomError
StreamError

A stream parser errors.

TokenType

List of token types.

XmlError

An XML parser errors.

XmlParseError

Constants

DEFAULT_ARGS

Traits

XmlComponent

Specifies a component that reacts to a parsed XML node

Functions

cascade_dom
combine_and_replace_dynamic_items

Combines the split string back into its original form while replacing the variables with their values

compile_body_node_to_rust_code
compile_component
compile_components
compile_components_to_rust_code

Takes all components and generates the source code function from them

compile_node_to_rust_code_inner
find_attribute
find_node_by_type

Searches in the the root_nodes for a node_type, convenience function in order to for example find the first node in all these nodes.

format_args_dynamic

Given a string and a key => value mapping, replaces parts of the string with the value, i.e.:

format_component_args
get_body_node

Find the one and only <body> node, return error if there is no app node or there are multiple app nodes

get_item

Given a root node, traverses along the hierarchy, and returns a mutable reference to the last child node of the root node

get_xml_components

Filter all <component /> nodes and insert them into the components node

layout_dom
load_style_file_from_xml

Tries to look for a <link type="stylesheet" href="blah.css" /> in the <head> node, then parse the CSS

normalize_casing

Normalizes input such as abcDef, AbcDef, abc-def to the normalized form of abc_def

parse_bool

Parses a string ("true" or "false")

parse_component_arguments

Compiles a XML args="a: String, b: bool" into a ["a" => "String", "b" => "bool"] map

parse_xml_string

Parses the XML string into an XML tree, returns the root <app></app> node, with the children attached to it.

prepare_string
render_component_inner
render_dom_from_body_node
render_dom_from_body_node_inner

Takes a single (expanded) app node and renders the DOM or returns an error

set_attributes
set_stringified_attributes
split_dynamic_string

Splits a string into formatting arguments

str_to_dom

Parses an XML string and returns a Dom with the components instantiated in the <app></app>

str_to_rust_code

Parses an XML string and returns a String, which contains the Rust source code (i.e. it compiles the XML to valid Rust)

validate_and_filter_component_args

Filters the XML attributes of a component given XmlAttributeMap

Type Definitions

CompiledComponent
ComponentArgumentName
ComponentArgumentOrder
ComponentArgumentType
ComponentArgumentsMap
ComponentName
FilteredComponentArguments
SyntaxError

Error that can happen during hot-reload - stringified, since it is only used for printing and is not exposed in the public API

XmlAttributeKey

Key of an attribute, such as the "color" in <button color="blue">Hello</button>.

XmlAttributeMap

Attributes of an XML node, such as ["color" => "blue"] in <button color="blue" />.

XmlAttributeValue

Value of an attribute, such as the "blue" in <button color="blue">Hello</button>.

XmlTagName

Tag of an XML node, such as the "button" in <button>Hello</button>.

XmlTextContent

(Unparsed) text content of an XML node, such as the "Hello" in <button>Hello</button>.