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

std::io: Modify some ReadBuf method signatures to return &mut Self #95770

Merged
merged 1 commit into from
Jun 10, 2022

Commits on May 3, 2022

  1. std::io: Modify some ReadBuf method signatures to return &mut Self

    This allows using `ReadBuf` in a builder-like style and to setup a `ReadBuf` and
    pass it to `read_buf` in a single expression, e.g.,
    
    ```
    // With this PR:
    reader.read_buf(ReadBuf::uninit(buf).assume_init(init_len))?;
    
    // Previously:
    let mut buf = ReadBuf::uninit(buf);
    buf.assume_init(init_len);
    reader.read_buf(&mut buf)?;
    ```
    
    Signed-off-by: Nick Cameron <nrc@ncameron.org>
    nrc committed May 3, 2022
    Configuration menu
    Copy the full SHA
    a3c30e4 View commit details
    Browse the repository at this point in the history