Skip to main content

Module format_rust_code

Module format_rust_code 

Source
Expand description

Const-compatible Rust source code generation from parsed CSS. Generates const-compatible Rust source code from parsed CSS values.

This module provides the [FormatAsRustCode] trait for converting CSS types into Rust source strings, [GetHash] for content-based deduplication, and [VecContents] for collecting heap-allocated CSS values that must be declared as const slices before use in generated code.

Primary consumer: core::xml uses this for CSS-to-Rust code generation.

Structs§

VecContents
Collects heap-allocated CSS values (strings, vecs) that must be emitted as const slice declarations before the generated Rust code can reference them.

Traits§

FormatAsRustCode
Formats a value as const-compatible Rust source code.
GetHash
Returns a deterministic 64-bit hash for content-based deduplication.

Functions§

format_angle_value
Formats an AngleValue as a const-compatible Rust constructor call.
format_color_value
Formats a ColorU as a const-compatible Rust struct literal.
format_float_value
Formats a FloatValue as a const-compatible Rust constructor call.
format_percentage_value
Formats a PercentageValue as a const-compatible Rust constructor call.
format_pixel_value
Formats a PixelValue as a const-compatible Rust constructor call.
format_pixel_value_no_percent
Formats a PixelValueNoPercent as a const-compatible Rust constructor call.
format_scrollbar_info
Formats a ScrollbarInfo as a const-compatible Rust struct literal.