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

Prototype a new Buffer trait. #1290

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Prototype a new Buffer trait. #1290

wants to merge 23 commits into from

Conversation

sunfishcode
Copy link
Member

I'm experimenting with a Buffer trait similar to #908, however I've run into a few problems. See the questions in examples/new_read.rs for details.

@notgull @SUPERCILEX

Copy link
Contributor

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

If we go with this approach, I feel like there's a pretty good chance compiler folks will improve the error messages for us if we file bug reports. The story around passing in a mutable array but needing a slice instead has annoyed me for quite some time (I usually just as_mut_slice everything). It was pretty confusing to figure out initially, so I'm sure better error messages would be welcome.

@sunfishcode sunfishcode mentioned this pull request Jan 27, 2025
21 tasks
@sunfishcode sunfishcode added the semver bump Issues that will require a semver-incompatible fix label Jan 30, 2025
@sunfishcode sunfishcode force-pushed the sunfishcode/new-read branch 4 times, most recently from f2eaa94 to 2278976 Compare February 4, 2025 12:35
@SUPERCILEX
Copy link
Contributor

Looking at our APIs, I think we'd want to consider adding uninit methods to roughly these methods (the filtering is not great, sorry):

@sunfishcode sunfishcode marked this pull request as ready for review February 25, 2025 20:16
@sunfishcode
Copy link
Member Author

Ok, I've now updated everything in rustix to use the new Buffer trait, except:

  • readlink, readlinkat, ptsname, ttyname - These return CString, which is a little different than a buffer of u8.
  • The ancillary data API for sendmsg/recvmsg. These are tricky.

I'm not opposed to having them use Buffer, I've just run out of steam for doing them myself. If anyone would like to see them migrated, PRs would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver bump Issues that will require a semver-incompatible fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants