Skip to content

BufReader/Writer extension methods: is_empty, buffer #45323

Description

@fintelia

Update: this is the tracking issue for:

impl<R: Read> BufReader<R> {
    pub fn buffer(&self) -> &[u8] {}

    #[rustc_deprecated(since = "1.26.0", reason = "use .buffer().is_empty() instead")]
    pub fn is_empty(&self) -> bool {}
}

is_empty is both unstable and deprecated, it should be removed.


There is currently no way to tell whether there is any data buffered inside a BufReader. This is unfortunate because it means that an application has no way to know whether calls to read() and fill_buffer() will return instantly or trigger a potentially expensive call to the underlying Reader. I propose adding an is_empty() method to BufReader to fill this gap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions