Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: soften ‘at most one write attempt’ requirement in io::Write::write #107200

Merged
merged 4 commits into from
Jun 18, 2023

Commits on Jan 24, 2023

  1. 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
    mina86 committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    316742e View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2023

  1. Configuration menu
    Copy the full SHA
    8654669 View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2023

  1. Update library/std/src/io/mod.rs

    Co-authored-by: Andrew Gallant <jamslam@gmail.com>
    mina86 and BurntSushi committed Mar 1, 2023
    Configuration menu
    Copy the full SHA
    5451dfe View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2023

  1. Update library/std/src/io/mod.rs

    Co-authored-by: Jacob Lifshay <programmerjake@gmail.com>
    mina86 and programmerjake authored Mar 3, 2023
    Configuration menu
    Copy the full SHA
    7d57cd5 View commit details
    Browse the repository at this point in the history