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

Introduce traits for SidePanel and TopBottomPanel #5651

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

sharky98
Copy link

@sharky98 sharky98 commented Jan 30, 2025

I made the change against 0.30.0 for now to test in my own code if that work like I hoped. I will bring the changes in master afterwards.

⚠️ This would be a breaking change, since use must import the trait to use the methods transfered to the traits.

@sharky98
Copy link
Author

sharky98 commented Jan 30, 2025

EDIT: Seems that removing the mut from self in the method declaration in the traits remove that issue. The #[inline] are now removed from the traits.


I have some trouble with ./script/check.sh and the linting. It ask to add #[inline] with message "builder methods should be marked #[inline]" on the traits method. But then cargo doc says it's an error: "error: #[inline] is ignored on function prototypes".

+ ./scripts/lint.py
./crates/egui/src/containers/panel.rs:72: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:77: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:80: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:83: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:86: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:89: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:92: builder methods should be marked #[inline]
./crates/egui/src/containers/panel.rs:95: builder methods should be marked #[inline]
+ ./scripts/lint.py
./scripts/lint.py finished without error
+ cargo fmt --all -- --check
+ cargo doc --quiet --lib --no-deps --all-features
[...]
error: `#[inline]` is ignored on function prototypes
  --> crates/egui/src/containers/panel.rs:72:5
   |
72 |     #[inline]
   |     ^^^^^^^^^
   |
   = note: `-D unused-attributes` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_attributes)]`

@sharky98
Copy link
Author

Ran the test locally, I have the following result: Test egui: 308 total, 7 failed, 7 ignored, 294 passed. The 7 failed tests seems all to be related to git-lfs and InvalidSignature, even though it is installed.

@sharky98
Copy link
Author

Turns out, my idea wasn't as easy to implement that I expected (Rust beginner here 😅). I'll rethink this a bit!

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.

Introduce a Panel trait for SidePanel and TopBottomPanel
1 participant