rust/library/std/src/io/buffered
Guillaume Boisseau 9ccf798fff
Rollup merge of #121403 - kornelski:io-oom, r=dtolnay
impl From<TryReserveError> for io::Error

There's an obvious mapping between these two errors, and it makes I/O code less noisy.

I've chosen to use simple `ErrorKind::OutOfMemory` `io::Error`, without keeping `TryReserveError` for the `source()`, because:

* It matches current uses in libstd,
* `ErrorData::Custom` allocates, which is a risky proposition for handling OOM errors specifically.
* Currently `TryReserveError` has no public fields/methods, so it's usefulness is limited. How allocators should report errors, especially custom and verbose ones is still an open question.

Just in case I've added note in the doccomment that this may change.

The compiler forced me to declare stability of this impl. I think this implementation is simple enough that it doesn't need full-blown stabilization period, and I've marked it for the next release, but of course I can adjust the attribute if needed.
2024-03-09 21:40:07 +01:00
..
bufreader Avoid defensive re-initialization of the BufReader buffer 2022-10-06 23:31:57 -04:00
bufreader.rs Remove unnecessary map_err 2024-02-21 16:31:53 +00:00
bufwriter.rs Fix quadratic behavior of repeated vectored writes 2024-03-03 14:32:36 +01:00
linewriter.rs Relax implicit W: Sized bound on LineWriter<W> 2023-05-01 23:56:23 +00:00
linewritershim.rs Fix quadratic behavior of repeated vectored writes 2024-03-03 14:32:36 +01:00
mod.rs Compute most of Public/Exported access level in rustc_resolve 2022-01-09 21:33:14 +00:00
tests.rs rewrite: line_long_tail_not_flushed description 2023-04-26 02:11:13 -04:00