Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xilem: Port the rest of the existing widgets and the mason example #1

Conversation

Philipp-M
Copy link
Collaborator

This should port the rest of the widgets and the old mason example (just memoize is missing, I'm looking into whether that fits into core).

What this revealed though, is a bug within the AnyView I haven't looked into that in detail yet, maybe you're faster in finding the issue, it's about casting between changing element types that seem to fail. Try clicking the checkbox...

mut element: WidgetMut<Self::Element>,
(): &mut Self::ViewState,
cx: &mut ViewCtx,
mut element: WidgetMut<'_, widget::Checkbox>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure whether we should generally use the qualified View::Element::Mut path or the concrete type, I used latter, because I think it's slightly more readable.

Copy link
Owner

Choose a reason for hiding this comment

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

Agreed, the "resolved" version is better.

The reason I didn't before is only because rust-analyzer autofills it to the referential version

It was trying to cast the old state and element
to the type which they will be
@DJMcNab
Copy link
Owner

DJMcNab commented May 26, 2024

Thanks so much for porting these. That's a massive help, and hopefully it'll help you to review linebender#310

@DJMcNab DJMcNab merged commit 455efcc into DJMcNab:core-two May 26, 2024
8 checks passed
DJMcNab added a commit that referenced this pull request Nov 11, 2024
New tracy image:


![image](https://github.com/user-attachments/assets/94e54c89-8159-4dd4-a521-4a7122f64375)

New log tracing file:
<details><summary>An overview of the new logs</summary>
<p>

```
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}: masonry::passes::update: RootWidget received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}: masonry::passes::update: SizedBox received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}:Flex{id=#3}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}:Flex{id=#3}:Prose{id=#1}: masonry::passes::update: Prose received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}:Flex{id=#3}:Label{id=#2}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}:Flex{id=linebender#5}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#8}:SizedBox{id=linebender#7}:Flex{id=linebender#6}:Flex{id=linebender#5}:VariableLabel{id=#4}: masonry::passes::update: VariableLabel received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#10}: masonry::passes::update: Button received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#10}:Label{id=linebender#9}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#12}: masonry::passes::update: Button received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#12}:Label{id=linebender#11}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#14}: masonry::passes::update: Button received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#14}:Label{id=linebender#13}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#16}: masonry::passes::update: Button received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Flex{id=linebender#17}:Button{id=linebender#16}:Label{id=linebender#15}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}: masonry::passes::update: Portal received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}: masonry::passes::update: SizedBox received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}:Flex{id=linebender#20}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}:Flex{id=linebender#20}:Prose{id=linebender#18}: masonry::passes::update: Prose received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}:Flex{id=linebender#20}:Label{id=linebender#19}: masonry::passes::update: Label received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}:Flex{id=linebender#22}: masonry::passes::update: Flex received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#24}:Flex{id=linebender#23}:Flex{id=linebender#22}:VariableLabel{id=linebender#21}: masonry::passes::update: VariableLabel received Update::WidgetAdded
14:37:40.365Z TRACE update_new_widgets:RootWidget{id=linebender#165}:Flex{id=linebender#164}:Portal{id=linebender#163}:Flex{id=linebender#160}:SizedBox{id=linebender#31}: masonry::passes::update: SizedBox received Update::WidgetAdded
```

</p>
</details> 

This was originally an experiment into caching spans, but I determined
that was non-viable due to the pass names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants