Skip to content

std::io::Take should have into_inner() method #23755

@lilyball

Description

@lilyball

It seems like a reasonably obvious thing to do and would be trivial to implement. The only alternative right now is to always use .by_ref() before calling .take(), and that's not always viable (e.g. because the io::Take needs to be kept around without borrowing the owner of the underlying reader).

An example usage would be implementing a message-based protocol on top of a stream protocol, where the messages either have fixed-length frames or have length indicators, I might want to call .take() to be able to work with a single message and then .into_inner() when I'm done to recover the underlying reader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-unstableBlocker: Implemented in the nightly compiler and unstable.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions