Skip to main content

azul_css/
lib.rs

1//! Provides datatypes used to describe an application's style using the Azul GUI framework.
2//!
3//! # Modules
4//!
5//! - [`css`]: Stylesheet types (rules, selectors, declarations).
6//! - [`props`]: Typed CSS property values (colors, lengths, layout properties).
7//! - [`parser2`]: CSS string parsing (feature-gated behind `"parser"`).
8//! - [`system`]: Native OS theme discovery and system colors.
9//! - [`shape`]: Text shaping and glyph layout.
10//! - [`shape_parser`]: Font and shape metric parsing.
11//! - [`dynamic_selector`]: Runtime selector matching helpers.
12//! - [`compact_cache`]: Compact caching utilities for resolved styles.
13//! - [`corety`]: Core type aliases re-exported at crate root.
14// Lint policy: deny correctness/safety issues, warn on style
15#![deny(unused_must_use)]
16#![warn(clippy::all)]
17// Extreme-lint lockdown: all clippy groups plus opt-in rustc lints, enforced as
18// -D warnings on library code by the CI clippy job. Test builds are exempt via
19// cfg(not(test)) below since the set is high-noise and low-value on unit and
20// generated tests; clippy::all correctness still applies to test code.
21#![cfg_attr(not(test), warn(
22    clippy::pedantic,
23    clippy::nursery,
24    clippy::cargo,
25    // missing_docs,  // TODO(docs): re-enable as a dedicated final docs pass; disabled
26    //                // for now so the cleanup focuses on code-quality lints, not doc debt.
27    missing_debug_implementations,
28    missing_copy_implementations,
29    unreachable_pub,
30    unused_qualifications,
31    unused_lifetimes,
32    unused_import_braces,
33    unused_macro_rules,
34    unused_crate_dependencies,
35    meta_variable_misuse,
36    trivial_casts,
37    trivial_numeric_casts,
38    elided_lifetimes_in_paths,
39    single_use_lifetimes,
40    variant_size_differences,
41    non_ascii_idents,
42    unsafe_op_in_unsafe_fn,
43    let_underscore_drop,
44))]
45// Allowed: macros generate PartialOrd alongside Ord, legacy numeric constants
46// in spec-derived code, into_iter naming for custom collection types
47#![allow(
48    clippy::non_canonical_partial_ord_impl,
49    clippy::legacy_numeric_constants,
50    clippy::should_implement_trait,       // into_iter on custom vecs
51    clippy::result_unit_err,              // parser returns Result<_, ()>
52    clippy::ptr_as_ptr,                   // FFI pointer casts
53    clippy::too_many_arguments,
54    unused_imports,                        // conditional compilation
55    unused_variables,
56    unused_mut,
57    unused_parens,
58    dead_code,
59    unused_doc_comments,                   // doc comments before macro invocations
60    ambiguous_glob_reexports,             // layout/style mod re-exports
61    unreachable_patterns,                  // exhaustive match in generated code
62)]
63
64// #![no_std]
65
66#[macro_use]
67extern crate alloc;
68extern crate core;
69
70#[macro_use]
71/// Internal macros for reducing boilerplate in property definitions.
72pub mod macros;
73/// Internal numeric-cast helpers (named, documented `as` conversions).
74/// `pub` + `pub(crate)` fns so it trips neither `unreachable_pub` nor
75/// `redundant_pub_crate` (they conflict); `#[doc(hidden)]` keeps it out of the API.
76#[doc(hidden)]
77pub mod cast;
78/// Multi-language code generation backends (Rust, C++, Python).
79pub mod codegen;
80/// Three-tier numeric property cache for fast style resolution.
81pub mod compact_cache;
82/// FFI-safe core type aliases (`AzString`, `AzVec`, `OptionT`, etc.).
83pub mod corety;
84/// Stylesheet types: rules, selectors, declarations, and specificity.
85pub mod css;
86/// Typed default values for CSS properties (font size, font id, text color).
87pub mod defaults;
88/// Runtime CSS selector matching (`:hover`, `@os`, `@media`, etc.).
89pub mod dynamic_selector;
90/// CSS string parser (tokenizer, declaration parser, shorthand expansion).
91#[cfg(feature = "parser")]
92pub mod parser2;
93/// Typed CSS property values: colors, lengths, layout, backgrounds, etc.
94pub mod props;
95/// CSS Shape data structures (`shape-inside`, `shape-outside`, `clip-path`).
96pub mod shape;
97/// Parser for CSS shape functions and font metrics.
98pub mod shape_parser;
99/// Native OS theme discovery: system colors, fonts, and DPI.
100pub mod system;
101
102pub use self::corety::*;