]> git.lizzy.rs Git - rust.git/commit
rollup merge of #21835: alexcrichton/iov2
authorAlex Crichton <alex@alexcrichton.com>
Tue, 3 Feb 2015 23:35:54 +0000 (15:35 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 3 Feb 2015 23:35:54 +0000 (15:35 -0800)
commitb53695b47af4705974038fa5f001c795644ece2d
tree6979c0b98c981380ab4f94b6171501f20797bdab
parent8550bf74c1149eb54fc568bb53b78fd2b6caec98
parent5cf9905e257ddeeadaf493a705a230081a6c7da3
rollup merge of #21835: alexcrichton/iov2

This commit is an implementation of [RFC 576][rfc] which adds back the `std::io`
module to the standard library. No functionality in `std::old_io` has been
deprecated just yet, and the new `std::io` module is behind the same `io`
feature gate.

[rfc]: https://github.com/rust-lang/rfcs/pull/576

A good bit of functionality was copied over from `std::old_io`, but many tweaks
were required for the new method signatures. Behavior such as precisely when
buffered objects call to the underlying object may have been tweaked slightly in
the transition. All implementations were audited to use composition wherever
possible. For example the custom `pos` and `cap` cursors in `BufReader` were
removed in favor of just using `Cursor<Vec<u8>>`.

A few liberties were taken during this implementation which were not explicitly
spelled out in the RFC:

* The old `LineBufferedWriter` is now named `LineWriter`
* The internal representation of `Error` now favors OS error codes (a
  0-allocation path) and contains a `Box` for extra semantic data.
* The io prelude currently reexports `Seek` as `NewSeek` to prevent conflicts
  with the real prelude reexport of `old_io::Seek`
* The `chars` method was moved from `BufReadExt` to `ReadExt`.
* The `chars` iterator returns a custom error with a variant that explains that
  the data was not valid UTF-8.
src/libstd/lib.rs