Add support for parsing Taffy style types from string (#929)
1[package]
2name = "taffy"
3version = "0.9.2"
4authors = [
5 "Alice Cecile <alice.i.cecile@gmail.com>",
6 "Johnathan Kelley <jkelleyrtp@gmail.com>",
7 "Nico Burns <nico@nicoburns.com>",
8]
9edition = "2021"
10rust-version = "1.71"
11include = ["src/**/*", "examples/**/*", "Cargo.toml", "README.md"]
12description = "A flexible UI layout library "
13repository = "https://github.com/DioxusLabs/taffy"
14keywords = ["cross-platform", "layout", "flexbox", "css-grid", "grid"]
15categories = ["gui"]
16license = "MIT"
17
18[dependencies]
19arrayvec = { version = "0.7", default-features = false }
20document-features = { version = "0.2.7", optional = true }
21serde = { version = "1.0", default-features = false, optional = true, features = ["serde_derive"] }
22slotmap = { version = "1.0.6", default-features = false, optional = true }
23grid = { version = "1.0.0", default-features = false, optional = true }
24cssparser = { version = "0.37.0", default-features = false, optional = true }
25
26[package.metadata.docs.rs]
27# To test all the documentation related features, run:
28# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps --open
29
30all-features = true
31# see https://doc.rust-lang.org/nightly/rustdoc/scraped-examples.html
32cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
33rustdoc-args = ["--cfg", "docsrs"]
34
35[features]
36default = [
37 "std",
38 "taffy_tree",
39 "flexbox",
40 "grid",
41 "block_layout",
42 "float_layout",
43 "calc",
44 "content_size",
45 "detailed_layout_info",
46 "parse",
47 "parse_faster"
48]
49#! ## Feature Flags
50#!
51#! ### Algorithms
52
53## Enables the Block layout algorithm. See [`compute_block_layout`](crate::compute_block_layout).
54block_layout = []
55## Enables the Float layout algorithm. This is a sub-feature of block layout.
56float_layout = []
57## Enables the Flexbox layout algorithm. See [`compute_flexbox_layout`](crate::compute_flexbox_layout).
58flexbox = []
59## Enables the CSS Grid layout algorithm. See [`compute_grid_layout`](crate::compute_grid_layout).
60grid = ["alloc", "dep:grid"]
61## Enables calc() values for all layout algorithms
62calc = []
63## Causes all algorithms to compute and output a content size for each node
64content_size = []
65## Causes algorithms to stores detailed information of the nodes in TaffyTree, with only CSS Grid supporting this.
66detailed_layout_info = []
67## Use strict provenance APIs for pointer manipulation. Using this feature requires Rust 1.84 or higher.
68strict_provenance = []
69
70#! ### Taffy Tree
71
72## Enable the built-in Taffy node tree. See [`TaffyTree`](crate::TaffyTree).
73taffy_tree = ["dep:slotmap"]
74
75#! ### Other
76
77## Add [`serde`] derives to Style structs
78serde = ["dep:serde"]
79## Implement `FromStr` trait for Taffy style types
80parse = ["dep:cssparser"]
81## Enable the `parse` feature with proc-macro dependent optimisations
82parse_faster = ["parse", "cssparser/fast_match_byte"]
83## Allow Taffy to depend on the [`Rust Standard Library`](std)
84std = ["grid?/std", "serde?/std", "slotmap?/std"]
85## Allow Taffy to depend on the alloc library
86alloc = ["serde?/alloc"]
87## Internal feature for debugging
88debug = ["std"]
89## Internal feature for profiling
90profile = ["std"]
91
92[dev-dependencies]
93serde_json = "1.0.93"
94taffy_test_helpers = { path = "tests/common"}
95
96# Enable default features for tests and examples
97taffy = { path = "." }
98
99[profile.release]
100lto = true
101panic = 'abort'
102
103[[bench]]
104name = "dummy_benchmark"
105path = "benches/dummy_benchmark.rs"
106harness = false
107
108[[example]]
109name = "basic"
110# This causes all the examples to be scraped for documentation, not just the basic example
111doc-scrape-examples = true
112
113[workspace]
114members = [
115 "scripts/gentest",
116 "scripts/format-fixtures",
117 "scripts/import-yoga-tests",
118 "tests/common",
119]
120# The cosmic_text example and benches are excluded from the workspace as including them breaks compilation
121# of all crates in the workspace with our MSRV compiler
122exclude = ["examples/cosmic_text", "benches"]