-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std::io: Add .lines() method to Buffer #10856
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
@@ -25,34 +25,42 @@ Some examples of obvious things you might want to do | |||
|
|||
* Read lines from stdin | |||
|
|||
for stdin().each_line |line| { | |||
println(line) | |||
let stdin = stdin(); |
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.
Based on the current (incorrect) display, I think these code snippets need to be either indented more, or wrapped in ~~~ or ``` (whichever one we're supposed to be using).
(Thanks for updating them!)
Changed |
Uh, this fails at
Investigating. |
The failure was because |
I think that the best modification to the current API as-is is to modify |
Updated. It means the api semantics will be changed again later, right? |
needs a rebase, otherwise looks good to me. |
rebased! |
Hm I also just realized that this is 6 commits, could you rebase these into one? |
- `Buffer.lines()` returns `LineIterator` which yields line using `.read_line()`. - `Reader.bytes()` now takes `&mut self` instead of `self`. - `Reader.read_until()` swallows `EndOfFile`. This also affects `.read_line()`.
done. |
The `.lines()` method creates an iterator which yields line with trailing ' '. (So it is slightly different to `StrSlice.lines()`; I don't know if it's worth to synchronize them.)
The
.lines()
method creates an iterator which yields line with trailing '\n'.(So it is slightly different to
StrSlice.lines()
; I don't know if it's worth to synchronize them.)