-
Notifications
You must be signed in to change notification settings - Fork 89
feat(io)!: support generic buffer for Framed
#642
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
base: master
Are you sure you want to change the base?
feat(io)!: support generic buffer for Framed
#642
Conversation
09fb8dd to
7daa31e
Compare
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
04e1739 to
b8e9d1d
Compare
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.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
compio-io/src/framed/read.rs:105
Buffer::reservecurrently treatsReserveError::NotSupportedas a no-op. If a non-growable buffer is full,io.append(buf)will read into a 0-lengthUninitslice and likely returnOk(0), which gets treated as EOF. Consider usingtry_reservehere and, onNotSupported(or if the buffer is already filled), return an explicit error (e.g.io::ErrorKind::OutOfMemory/ frame-too-large) instead of attempting a read.
buf.reserve(16);
let fut = Box::pin(async move {
let res = buf.with(|buf| io.append(buf)).await;
(io, BufResult(res, buf))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b8e9d1d to
416199d
Compare
Closes #577.
@code-withAshish
The new API gives implentator a
&Slice<B>as the sliced view into the buffer. WithBytes, it's possible to do this:I have added a helper function for
Slice<Bytes>,slice_bytesto do exactly this. Generally, one can still use&Slice<B: IoBuf>as a&[u8]since it implementsDeref<Target = [u8]>.