about summary refs log tree commit diff
path: root/library/std/src/io/util/tests.rs
AgeCommit message (Collapse)AuthorLines
2025-03-10Implement default methods for io::Empty and io::SinkThalia Archibald-11/+100
Eliminate any redundant, unobservable logic from the their default method implementations. The observable changes are that `Write::write_fmt` for both types now ignores the formatting arguments, so a user fmt impl which has side effects is not invoked, and `Write::write_all_vectored` for both types does not advance the borrowed buffers. Neither behavior is guaranteed by the docs and the latter is documented as unspecified. `Empty` is not marked as vectored, so that `Chain<Empty, _>` and `Chain<_, Empty>` are not forced to be vectored.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+0
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2023-07-30Rollup merge of #98154 - vidhanio:master, r=workingjubileeMatthias Krüger-2/+11
merge functionality of `io::Sink` into `io::Empty` Many times, there is a need for a simple dummy `io::Read`er + `io::Write`r, but currently the only options are `io::Empty` and `io::Sink` respectively. Having both of their functionality together requires writing your own boilerplate for something that makes sense to have in the standard library. This PR adds the functionality of `io::Sink` to `io::Empty`, making `io::Empty` be able to perform the tasks of both of the previous structs. (This idea was first mentioned in #24235) Note: I also updated some doc comments in `io::utils` in this pull request to fix inconsistencies between `io::Sink` and `io::Empty`. API Change Proposal: https://github.com/rust-lang/libs-team/issues/49
2023-06-17Extend io::copy buffer reuse to BufReader tooThe 8472-60/+1
previously it was only able to use BufWriter. This was due to a limitation in the BufReader generics that prevented specialization. This change works around the issue by using `where Self: Read` instead of `where I: Read`. This limits our options, e.g. we can't access BufRead methods, but it happens to work out if we rely on some implementation details.
2023-05-05feat: merge functionality of `io::Sink` into `io::Empty`Vidhan Bhatt-2/+11
2022-08-05non-linux platformsNick Cameron-5/+5
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-04std::io: migrate ReadBuf to BorrowBuf/BorrowCursorNick Cameron-24/+24
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-11-02read_bufDrMeepster-1/+28
2021-01-31specialize io::copy to use the memory of the writer if it is a BufWriterThe8472-1/+49
2021-01-30impl Seek for Emptyoberien-1/+21
Fix #78029
2020-11-06Make some std::io functions `const`Benoît du Garreau-1/+8
Includes: - io::Cursor::new - io::Cursor::get_ref - io::Cursor::position - io::empty - io::repeat - io::sink
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-0/+45
Also doing fmt inplace as requested.