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 BorrowedFd in arguments #640

Merged
merged 1 commit into from
Sep 2, 2023
Merged

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Jul 13, 2023

Implementation of #592.

This is required for IO safety. Or perhaps AsFd generics would be useful.

This will be a breaking API change, and require Rust 1.65.

Currently wayland-client compiles here, but server-side needs the same changes, and things need to be cleaned up a bit.

@ids1024
Copy link
Member Author

ids1024 commented Jul 13, 2023

Hm, an awkward API stability concern here: adding Request/Event enums are non-exhastive. So adding a variant is considered a non-breaking change. But as this is currently implemented in this PR, adding a variant with an FD adds a type generic, which is breaking.

That is needed because an enum can't have a type generic unless a variant uses that type parameter. Maybe if it's non-exhaustive anyway, it could have a variant that's never constructed with a PhantomData? And an uninhabited type for good measure.

@ids1024
Copy link
Member Author

ids1024 commented Jul 13, 2023

Currently Request/Event types and methods also accept String and Vec<u8> instead of &str and &[u8]. Not that much of an issue since those types aren't the most common in Wayland, but presumably with a GAT here those could also be changed, avoiding an extra allocation and provide a more idiomatic API.

@ids1024 ids1024 force-pushed the borrowedfd branch 3 times, most recently from ca803a4 to 3955b21 Compare July 14, 2023 20:50
@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Patch coverage: 98.46% and project coverage change: +0.03% 🎉

Comparison is base (799c772) 73.11% compared to head (f9f55d5) 73.15%.

❗ Current head f9f55d5 differs from pull request most recent head 5172cc5. Consider uploading reports for the commit 5172cc5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
+ Coverage   73.11%   73.15%   +0.03%     
==========================================
  Files          47       47              
  Lines        7693     7729      +36     
==========================================
+ Hits         5625     5654      +29     
- Misses       2068     2075       +7     
Flag Coverage Δ
main 58.57% <86.15%> (-0.03%) ⬇️
test-- 78.23% <100.00%> (+0.13%) ⬆️
test--server_system 61.47% <100.00%> (+0.17%) ⬆️
test-client_system- 69.26% <100.00%> (+0.13%) ⬆️
test-client_system-server_system 51.52% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
wayland-client/src/lib.rs 2.43% <ø> (ø)
wayland-cursor/src/lib.rs 0.00% <0.00%> (ø)
wayland-server/src/lib.rs 11.62% <ø> (ø)
wayland-client/src/conn.rs 86.29% <100.00%> (+0.45%) ⬆️
wayland-scanner/src/client_gen.rs 99.25% <100.00%> (-0.01%) ⬇️
wayland-scanner/src/common.rs 95.84% <100.00%> (+0.11%) ⬆️
wayland-scanner/src/server_gen.rs 99.11% <100.00%> (-0.01%) ⬇️
wayland-server/src/display.rs 81.92% <100.00%> (+1.15%) ⬆️

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ids1024 ids1024 force-pushed the borrowedfd branch 3 times, most recently from 3c6a66f to ce21e9b Compare July 26, 2023 21:03
@ids1024 ids1024 changed the title WIP use BorrowedFd in arguments Use BorrowedFd in arguments Jul 26, 2023
@ids1024 ids1024 marked this pull request as ready for review July 26, 2023 21:33
@ids1024
Copy link
Member Author

ids1024 commented Jul 26, 2023

Added generation of a #doc(hidden) phantom variant for API stability.

This should be good now.

Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
Copy link
Member

@elinorbgr elinorbgr left a comment

Choose a reason for hiding this comment

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

That's a solid PR, thanks!

@elinorbgr elinorbgr merged commit c21cabb into Smithay:master Sep 2, 2023
15 checks passed
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