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

Use nightly feature arbitrary_self_types #854

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PoignardAzur
Copy link
Contributor

@PoignardAzur PoignardAzur commented Jan 27, 2025

This is a showcase-only PR and isn't meant to be merged. This PR tries to show how the soon-to-be stabilized arbitrary_self_types will impact Masonry's codebase.

Note that it's a quick-and-dirty port; there's a ton of places in the code that end up calling Foobar::method(&mut foobar, ...) that could easily be refactored to foobar.method(...), I just didn't take the time to refactor them all.

@PoignardAzur
Copy link
Contributor Author

PoignardAzur commented Jan 27, 2025

Here's an example of what the user code ends up looking like:

let mut checkbox = checkbox.downcast::<Checkbox>();
checkbox.set_checked(true);
checkbox.set_text("The quick brown fox jumps over the lazy dog".into());
let mut label = checkbox.label_mut();
label.set_brush(PRIMARY_LIGHT);
label.insert_style(StyleProperty::FontSize(20.0));

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.

1 participant