about summary refs log tree commit diff
path: root/library/std/src/io/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-07-09core: Remove `BorrowedCursor::init_ref` methodBenoît du Garreau-3/+3
This method was not really useful: at no point one would only need to read the initialized part of the cursor without mutating it.
2025-07-01Update version placeholdersJosh Stone-1/+1
2025-06-10Rollup merge of #142102 - kiseitai3:141714_stdin_read_to_string_docs, r=tgross35León Orell Valerian Liehr-0/+40
docs: Small clarification on the usage of read_to_string and read_to_end trait methods Small clarification on the usage of read_to_string and read_to_end trait methods. The goal is to make it clear that these trait methods will become locked up if attempting to read to the end of stdin (which is a bit non-sensical unless the other end closes the pipe). Fixes: rust-lang/rust#141714
2025-06-10docs: Small clarification on the usage of read_to_string and read_to_end ↵kiseitai3-0/+40
trait methods
2025-06-05Clarify description of `Seek::stream_len`Tobias Bucher-1/+1
It can only describe the inner workings of the default implementation, other implementations might not be implemented using seeks at all.
2025-06-05Optimize `Seek::stream_len` impl for `File`Tobias Bucher-10/+14
It uses the file metadata on Unix with a fallback for files incorrectly reported as zero-sized. It uses `GetFileSizeEx` on Windows. This reduces the number of syscalls needed for determining the file size of an open file from 3 to 1.
2025-05-19Add `std::io::Seek` instance for `std::io::Take`Mario Pastorelli-1/+52
2025-04-25Grammar fixes for BufRead::has_data_left docsEthan Wu-2/+2
2025-04-15Add warning comment to `Take::get_ref` and `Chain::get_ref`Josh Triplett-0/+8
The methods `Take::get_mut` and `Chain::get_mut` include comments warning about modifying the I/O state of the underlying reader. However, many readers (e.g. `File`) allow I/O using a shared reference (e.g. `&File`). So, add the same caveat to the `get_ref` methods.
2025-04-09replace version placeholderBoxy-1/+1
2025-03-28`io::Take`: avoid new `BorrowedBuf` creation in some caseBenoît du Garreau-4/+4
2025-03-21Rollup merge of #138650 - thaliaarchi:io-write-fmt-known, r=ibraheemdevMatthias Krüger-35/+46
Optimize `io::Write::write_fmt` for constant strings When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
2025-03-19Rollup merge of #136177 - hkBst:patch-24, r=ibraheemdevMatthias Krüger-24/+17
clarify BufRead::{fill_buf, consume} docs Fixes #85394
2025-03-18Apply suggestions from code reviewMarijn Schouten-7/+7
Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
2025-03-18Optimize io::Write::write_fmt for constant stringsThalia Archibald-35/+46
When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
2025-03-14Stablize feature `anonymous_pipe`Jiahao XU-1/+1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-02-21Clarify/update comments in `BufRead::read_line`'s default bodyFrank Steffahn-1/+1
with where to *actually* look for more details
2025-02-12Add diagnostic item for `std::io::BufRead`Samuel Tardieu-0/+1
This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-07std: get rid of `sys_common::io`joboet-1/+1
2025-01-28clarify BufRead::{fill_buf, consume} docsMarijn Schouten-24/+17
Fixes #85394
2025-01-26Move `std::io::pipe` code into its own fileTobias Bucher-255/+3
2025-01-25Improve and expand documentation of pipesJosh Triplett-8/+14
- Simplify some of the language - Minor grammar fixes - Don't imply that pipes *only* work across multiple processes; instead, *suggest* that they're typically used across two or more separate processes. - Specify that portable applications cannot use multiple readers or multiple writers for messages larger than a byte, due to potential interleaving. - Remove no-longer-referenced footnote URLs.
2025-01-17Move `std::pipe::*` into `std::io`Jiahao XU-0/+249
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-12-21Less unwrap() in documentationKornel-10/+15
2024-11-25std: expose `const_io_error!` as `const_error!`joboet-2/+5
ACP: rust-lang/libs-team#205 Tracking issue: #133448
2024-11-09Add as_slice/into_slice for IoSlice/IoSliceMut.Alona Enraght-Moony-0/+45
Co-authored-by: Mike Pedersen <mike@mikepedersen.dk> Co-authored-by: Nathan West <Lucretiel@gmail.com>
2024-10-15replace placeholder versionJosh Stone-1/+1
(cherry picked from commit 567fd9610cbfd220844443487059335d7e1ff021)
2024-10-04Stabilize `BufRead::skip_until`okaneco-3/+1
2024-09-23Add a comment to `Read::read_buf`Benoît du Garreau-0/+2
2024-09-23Fix `io::default_read_to_end` uses of `read_buf`Benoît du Garreau-10/+14
2024-09-23Fix `io::Take::read_buf`Benoît du Garreau-4/+5
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-3/+3
2024-09-21wait for two short reads before uncapping the max read sizeThe 8472-3/+13
for disk IO: 1st short read = probably at end of file 2nd short read = confirming that it's indeed EOF
2024-09-20[Clippy] Remove final std paths for diagnostic itemGnomedDev-0/+1
2024-07-30Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68bors-4/+4
Bump bootstrap compiler to new beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-29Reformat `use` declarations.Nicholas Nethercote-11/+7
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28Update CURRENT_RUSTC_VERSIONMark Rousskov-4/+4
2024-07-26Fix doc nitsJohn Arundel-13/+13
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-14std: Unsafe-wrap std::ioJubilee Young-3/+2
2024-07-14std: deny(unsafe_op_in_unsafe_fn) but allow sitesJubilee Young-0/+1
This provides a list of locations to hunt down issues in.
2024-07-12Stabilize io_slice_advanceEduardo Sánchez Muñoz-12/+4
2024-06-11replace version placeholderPietro Albini-1/+1
2024-05-13Rollup merge of #123817 - slanterns:seek_relative, r=dtolnayMatthias Krüger-2/+1
Stabilize `seek_seek_relative` This PR stabilizes `seek_seek_relative`: ```rust // std::io::Seek trait Seek { fn seek_relative(&mut self, offset: i64) -> Result<()>; } ``` <br> Tracking issue: https://github.com/rust-lang/rust/issues/117374. Implementation PR: https://github.com/rust-lang/rust/pull/116750. FCPs already completed in the tracking issue. Closes https://github.com/rust-lang/rust/issues/117374. r? libs-api
2024-05-11io::Write::write_fmt: panic if the formatter fails when the stream does not failRalf Jung-1/+5
2024-05-04Rollup merge of #122441 - a1phyr:improve_read_impls, r=ChrisDentonMatthias Krüger-1/+4
Improve several `Read` implementations - `read_to_end` and `read_to_string` for `Cursor` - Error on OOM in `read_to_string` of `&[u8]` and `VecDeque<u8>` - Avoid making the slices contiguous in `VecDeque::read_to_string` - ~`read_exact` and (unstable) `read_buf_exact` for `Take`~ - ~`read_buf` for `UnixStream` and `&UnixStream`~ (moved to #123084) - `read_to_end` for `ChildStdErr`
2024-04-27io safety: update Unix explanationRalf Jung-1/+1
2024-04-12Avoid panicking branch in `append_to_string`Benoît du Garreau-1/+4
2024-04-11Rollup merge of #122882 - Zoxc:panic-output-panic, r=AmanieuMatthias Krüger-3/+3
Avoid a panic in `set_output_capture` in the default panic handler This avoid a panic in the default panic handler by not using `set_output_capture` as `OUTPUT_CAPTURE.with` may panic once `OUTPUT_CAPTURE` is dropped. A new non-panicking `try_set_output_capture` variant of `set_output_capture` is added for use in the default panic handler.
2024-04-12Stabilize `Seek::seek_relative`Slanterns-2/+1
2024-04-11Factor some common `io::Error` constantsBenoît du Garreau-23/+5