-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement Read, BufRead, Write and Seek for Cursor<Box<[u8]>> #27897
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -289,6 +295,16 @@ impl Write for Cursor<Vec<u8>> { | |||
fn flush(&mut self) -> io::Result<()> { Ok(()) } | |||
} | |||
|
|||
#[stable(feature = "cursor_box_slice", since = "1.4.0")] |
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.
There could be a doc comment here on the impl block explaining the semantics. It should be visible on the type's rustdoc page in the current implementation (so on Cursor's page).
The vector growing and the box merely filling is something that we probably want to put into the documentation somehow.
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.
Agreed - I have personally been a bit confused as to the exact semantics of some of the impls here. I believe that docs on the impl itself will not be rendered but docs on methods in the impl will.
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.
It's actually the opposite in my experience. #24838
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.
Ah this should actually be 1.5.0 now (oh how time flies!)
I'm a little worried about the interactions between this and #27197, as I think that attempting to generalize these implementations is probably a good idea and don't want to gain too many impl blocks here. I think that using the generalization of For writing, we could generalize over In that sense I would be ok exploring using cc @nwin |
I agree that the write part can’t be generalized easily, so I think it would be ok to implement Cursor for Box<[u8]>. I'm not sure about the |
@nwin unfortunately |
@alexcrichton: That is really unfortunate because then I do not see a nice solution. Seems we have the following options:
|
None of |
Er, that only applies to |
Given #27197 (which I'd personally be ok accepting) that would alter this to just adding |
The libs team is still holding off on this until #27197 is resolved (as a status update) |
☔ The latest upstream changes (presumably #27197) made this pull request unmergeable. Please resolve the merge conflicts. |
c3809c0
to
4d48801
Compare
rebased |
r=me with minor nit about the stable since |
4d48801
to
6b244d5
Compare
@bors r=alexcrichton |
📌 Commit 6b244d5 has been approved by |
No description provided.