-
Notifications
You must be signed in to change notification settings - Fork 78
refactor(buf): better IoBuf #555
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
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
I'm thinking of removing the unsafe requirement for constructing What do you think @Berrysoft |
|
It's OK. Actually I'm considering making the |
|
Another reason we previously make it unsafe is that |
Sounds good to me. Then I'll try to implement slice-based buffer tomorrow. |
In fact we don't need to: let's suppose the new api looks like common |
8beabb6 to
7430913
Compare
7430913 to
266ccb4
Compare
Berrysoft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR refactors compio-buf with following changes:
IoSlice{,Mut}. UseIoBuffer{,Mut}insteadIoBufonly requires singleunsafe fn buffer(&self) -> IoBufferandIoBufMutonly requiresfn uninit_len(&self) -> usize.IoSlice{,Mut}is being moved to driver, renamed toSysSliceand can be converted fromIoBuffer{,Mut}.IoVectoredBuf{,Mut}:IoVectoredBufnow only requiresunsafe fn iter_buffer(&self) -> impl Iterator<Item = IoBuffer>;IoVectoredBufMutnow only requiresfn uninit_len_of(&self, idx: usize) -> usize;which returnsuninit_lenof given index corresponding to index initer_buffer.