Cargo Features

[dependencies]
taffy = { version = "0.10.1", default-features = false, features = ["block_layout", "float_layout", "flexbox", "grid", "calc", "content_size", "detailed_layout_info", "strict_provenance", "taffy_tree", "serde", "parse", "parse_faster", "std", "alloc", "debug", "profile", "document-features"] }
default = block_layout, calc, content_size, detailed_layout_info, flexbox, float_layout, grid, std, taffy_tree

These default features are set whenever taffy is added without default-features = false somewhere in the dependency tree.

block_layout default

Feature Flags

Algorithms

Enables the Block layout algorithm. See compute_block_layout.

Affects style::Style.text_align, traits::LayoutBlockContainer, traits::LayoutBlockContainer.compute_block_child_layout

float_layout default

Enables the Float layout algorithm. This is a sub-feature of block layout.

Affects block::BlockItemStyle.float, block::BlockItemStyle.clear, style::Style.float, style::Style.clear

flexbox default

Enables the Flexbox layout algorithm. See compute_flexbox_layout.

Affects style::Style.flex_direction, style::Style.flex_wrap, style::Style.flex_basis, style::Style.flex_grow, style::Style.flex_shrink, traits::LayoutFlexboxContainer, style::Style.align_items, style::Style.align_self, style::Style.align_content, style::Style.justify_content, style::Style.gap

grid default = alloc

Enables the CSS Grid layout algorithm. See compute_grid_layout.

Enables grid

Affects style::Style.justify_items, style::Style.justify_self, style::Style.grid_template_rows, style::Style.grid_template_columns, style::Style.grid_auto_rows, style::Style.grid_auto_columns, style::Style.grid_auto_flow, style::Style.grid_template_areas, style::Style.grid_template_column_names, style::Style.grid_template_row_names, style::Style.grid_row, style::Style.grid_column, style_helpers::repeat, style_helpers::evenly_sized_tracks, style_helpers::minmax, style_helpers::flex, style_helpers::fr, traits::LayoutGridContainer, style::Style.align_items, style::Style.align_self

calc default

Enables calc() values for all layout algorithms

content_size default

Causes all algorithms to compute and output a content size for each node

Affects layout::LayoutOutput.content_size, layout::Layout.content_size

detailed_layout_info default

Causes algorithms to stores detailed information of the nodes in TaffyTree, with only CSS Grid supporting this.

Affects grid::DetailedGridInfo, grid::DetailedGridTracksInfo, grid::DetailedGridItemsInfo, compute::detailed_info, layout::DetailedLayoutInfo, traits::LayoutGridContainer.set_detailed_grid_info

strict_provenance

Use strict provenance APIs for pointer manipulation. Using this feature requires Rust 1.84 or higher.

taffy_tree default

Taffy Tree

Enable the built-in Taffy node tree. See TaffyTree.

Enables slotmap

serde

Other

Add serde derives to Style structs

Enables serde

parse parse_faster?

Implement FromStr trait for Taffy style types

Enables cssparser

parse_faster = parse

Enable the parse feature with proc-macro dependent optimisations

Enables fast_match_byte of cssparser

std default debug? profile?

Allow Taffy to depend on the Rust Standard Library

Enables std of optional grid, optional serde, and optional slotmap

Affects style::CheapCloneStr

alloc grid

Allow Taffy to depend on the alloc library

Enables alloc of optional serde

Affects style::CheapCloneStr

debug = std

Internal feature for debugging

Affects debug::DebugLogger

profile = std

Internal feature for profiling

Affects debug::DebugLogger

Features from optional dependencies

document-features implicit feature

Enables document-features

document-features:

Extract documentation for the feature flags from comments in Cargo.toml