package toffee
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/toffee.tree/Tree/Run_mode/index.html
Module Tree.Run_modeSource
Layout computation mode.
Run mode determines how layout algorithms execute: computing full layouts for all nodes, computing only container sizes, or handling hidden nodes. This affects which layout steps are performed and whether child layouts are computed.
Performance
Compute_size enables early exits in layout algorithms when only the container's dimensions are needed. Layout implementations check run mode and return immediately once container size is determined, skipping child positioning and final layout steps. This optimization is critical for intrinsic size queries (e.g., computing min-content or max-content widths) where only dimensions matter, not child positions.
type t = | Perform_layout(*Compute full layout for this node and all children.
All layout steps are performed, including child layout computation, positioning, and size determination. This is the standard mode for visible nodes requiring complete layout information.
*)| Compute_size(*Compute only the container size for this node.
Layout steps unnecessary for determining the node's container size may be skipped. This mode optimizes layout computation when only the node's dimensions are needed, not the full layout tree.
*)
to_string mode returns the string representation of mode.
Returns "PerformLayout", "ComputeSize", or "PerformHiddenLayout".
compare a b compares run modes a and b.
Ordering: Perform_layout < Compute_size < Perform_hidden_layout.
pp fmt mode prints mode to formatter fmt using to_string.