bevyengine / bevyengine/bevy

The `Measure` trait can't be implemented without importing taffy

Open
#21,423 3 comments 0 reactions 0 assignees View on GitHub
A-UI C-Usability S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

The `Measure` trait is `pub`:
```rust
pub trait Measure: Send + Sync + 'static {
fn measure(&mut self, measure_args: MeasureArgs<'_>, style: &taffy::Style) -> Vec2;
}
```
but we don't re-export `taffy::Style`, so it can't be implemented without adding a taffy dependency.

## What solution would you like?

We can re-export `Style` but that's not great, there are also a bunch of helper functions that are needed really to work with its types and some of the fields aren't used by bevy.

Contributor guide

Open the contributing guide

Research direction

Start at the public Measure trait and inspect its measure signature, especially the dependency on taffy::Style and the helper functions needed around its types. Compare the trait's required style data with the fields Bevy actually uses. Done means the API direction is decided and a Measure implementation no longer requires consumers to add a direct taffy dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.