cssbox_core/lib.rs
1//! `cssbox-core` — A standalone CSS layout engine.
2//!
3//! This crate implements CSS layout algorithms: block, inline, float,
4//! positioning, flexbox, grid, and table. It takes a tree of styled nodes
5//! as input and produces computed positions and sizes as output.
6//!
7//! # Usage
8//!
9//! ```rust
10//! use cssbox_core::tree::BoxTreeBuilder;
11//! use cssbox_core::style::ComputedStyle;
12//! use cssbox_core::geometry::Size;
13//! use cssbox_core::layout::{compute_layout, FixedWidthTextMeasure};
14//!
15//! let mut builder = BoxTreeBuilder::new();
16//! let root = builder.root(ComputedStyle::block());
17//! // ... add children ...
18//! let tree = builder.build();
19//!
20//! let result = compute_layout(&tree, &FixedWidthTextMeasure, Size::new(800.0, 600.0));
21//! let root_rect = result.bounding_rect(tree.root());
22//! ```
23
24#![allow(clippy::too_many_arguments)]
25#![allow(clippy::needless_range_loop)]
26
27pub mod block;
28pub mod box_model;
29pub mod flex;
30pub mod float;
31pub mod fragment;
32pub mod geometry;
33pub mod grid;
34pub mod inline;
35pub mod layout;
36pub mod position;
37pub mod style;
38pub mod table;
39pub mod tree;
40pub mod values;