Skip to content

Remove cache_mut, needs_measure and measure_node methods from LayoutTree trait#431

Merged
nicoburns merged 3 commits intoDioxusLabs:mainfrom
nicoburns:remove-cache-and-measure-funcs-from-layout-tree-trait
Apr 11, 2023
Merged

Remove cache_mut, needs_measure and measure_node methods from LayoutTree trait#431
nicoburns merged 3 commits intoDioxusLabs:mainfrom
nicoburns:remove-cache-and-measure-funcs-from-layout-tree-trait

Conversation

@nicoburns
Copy link
Copy Markdown
Collaborator

Objective

The aim is again to simplify the LayoutTree trait by removing unncessary methods. In this case, it is achieved by making the generic compute/mod and leaf compute functions take &mut Taffy instead of &mut impl LayoutTree. This works because these methods are private, and are only used when using the built in Taffy tree anyway.

Context

Split out from #326

Feedback wanted

General PR review.

@nicoburns nicoburns added usability Make the library more comfortable to use breaking-change A change that breaks our public interface labels Apr 10, 2023
@nicoburns nicoburns requested review from TimJentzsch and Weibye April 10, 2023 21:51
Copy link
Copy Markdown
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I noticed that we seem to be using the terms "node", "key" and "node id" to refer to the same thing (a NodeId), perhaps in a future PR we should try to make the variable names more consistent here

@nicoburns
Copy link
Copy Markdown
Collaborator Author

nicoburns commented Apr 10, 2023

LGTM.

I noticed that we seem to be using the terms "node", "key" and "node id" to refer to the same thing (a NodeId), perhaps in a future PR we should try to make the variable names more consistent here

key is different as it's a slotmap::DefaultKey, which we still need to use internally in the tree code (but not the compute code) as we're still using slotmaps for storage. But agree totally on node and node_id. I think we should be using node_id (or even just id) anytime the variable is a NodeId. But there's just a lot of places to update so it might takes a while to go through and update everything.

@nicoburns nicoburns merged commit 384b60b into DioxusLabs:main Apr 11, 2023
@nicoburns nicoburns deleted the remove-cache-and-measure-funcs-from-layout-tree-trait branch April 11, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A change that breaks our public interface usability Make the library more comfortable to use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants