rust/library/std/src
Matthias Krüger 876f00a655
Rollup merge of #107200 - mina86:c, r=Amanieu
io: soften ‘at most one write attempt’ requirement in io::Write::write

At the moment, documentation of std::io::Write::write indicates that
call to it ‘represents at most one attempt to write to any wrapped
object’.  It seems that such wording was put there to contrast it with
pre-1.0 interface which attempted to write all the data (it has since
been changed in [RFC 517]).

However, the requirement puts unnecessary constraints and may
complicate adaptors which perform non-trivial transformations on the
data.  For example, they may maintain an internal buffer which needs
to be written out before the write method accepts more data.  It might
be natural to code the method such that it flushes the buffer and then
grabs another chunk of user data.  With the current wording in the
documentation, the adaptor would be forced to return Ok(0).

This commit softens the wording such that implementations can choose
code structure which makes most sense for their particular use case.

While at it, elaborate on the meaning of `Ok(0)` return pointing out
that the write_all methods interprets it as an error.

[RFC 517]: https://rust-lang.github.io/rfcs/0517-io-os-reform.html
2023-06-18 08:06:41 +02:00
..
backtrace Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
collections Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieu 2023-06-15 00:03:10 +00:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error remove fn backtrace 2022-08-01 20:10:40 +00:00
f32 Remove some cfg(not(bootstrap)) 2022-12-11 01:20:18 -05:00
f64 Remove some cfg(not(bootstrap)) 2022-12-11 01:20:18 -05:00
ffi Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=Amanieu 2023-06-14 18:10:27 +02:00
fs Add test for FileTimes 2023-05-15 15:04:45 +01:00
io Rollup merge of #107200 - mina86:c, r=Amanieu 2023-06-18 08:06:41 +02:00
net add examples of port 0 binding behavior 2023-05-13 07:13:52 +00:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Rollup merge of #112352 - dankm:fbsd_doc_fix, r=thomcc 2023-06-17 12:43:29 +02:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path make many std tests work in Miri 2022-08-18 18:07:39 -04:00
personality Prevent aborting guard from aborting the process in a forced unwind 2023-05-07 12:35:54 +01:00
prelude correct std::prelude comment 2023-04-27 15:56:57 +02:00
process Implement read_buf for a few more types 2023-03-06 12:24:15 +01:00
sync doc: improve explanation 2023-06-01 12:55:58 +02:00
sys Auto merge of #112595 - hargoniX:l4re_fix, r=Mark-Simulacrum 2023-06-17 21:59:08 +00:00
sys_common Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=Amanieu 2023-06-14 18:10:27 +02:00
thread Fix typo in mod.rs 2023-06-13 00:09:13 +09:00
time Rollup merge of #103056 - beetrees:timespec-bug-fix, r=thomcc 2023-05-05 18:40:32 +05:30
alloc.rs Revert "Remove #[alloc_error_handler] from the compiler and library" 2023-04-25 00:08:35 +02:00
ascii.rs Add the basic ascii::Char type 2023-05-03 22:09:33 -07:00
backtrace.rs Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
env.rs Rollup merge of #109894 - fleetingbytes:109893-var_os-never-returns-an-error, r=cuviper 2023-04-11 20:28:46 -07:00
error.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
f32.rs abs_sub: fix typo 0[-:][+.]0 2023-06-10 10:45:50 -05:00
f64.rs abs_sub: fix typo 0[-:][+.]0 2023-06-10 10:45:50 -05:00
fs.rs Auto merge of #109773 - beetrees:set-file-time-improvements, r=Amanieu 2023-05-19 19:53:14 +00:00
keyword_docs.rs enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
lib.rs reorder attributes to make miri-test-libstd work again 2023-06-11 22:15:46 +02:00
macros.rs Add tidy check for dbg 2022-12-31 15:32:09 +05:30
num.rs Add Saturating type (based on Wrapping type) 2021-08-10 19:27:01 +02:00
panic.rs Shorten lifetime of even more panic temporaries 2023-05-15 03:47:37 -07:00
panicking.rs Rework handling of recursive panics 2023-05-27 16:35:16 +02:00
path.rs Mark internal functions and traits unsafe 2023-05-15 14:31:00 -04:00
personality.rs fix: get the l4re target working again 2023-06-13 20:41:33 +00:00
primitive_docs.rs Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
process.rs Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, r=Mark-Simulacrum 2023-05-08 04:50:28 +00:00
rt.rs Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
time.rs update wasi_clock_time_api ref. 2023-04-29 19:04:16 +08:00