Skip to content

Tracking issue for io_slice_advance #62726

Description

@Thomasdezeeuw

View all comments

This is a tracking issue for IoSlice::{advance, advance_slices} and IoSliceMut::{advance, advance_slices}.

Feature gate: #![feature(io_slice_advance)].

Steps:

Current API additions:

impl<'a> IoSlice<'a> { // And `IoSliceMut`
    pub fn advance(&mut self, n: usize);
    pub fn advance_slices(bufs: &mut &mut [IoSlice<'a>], n: usize);
}

Old issue:

Writing rust-lang/futures-rs#1741 I needed to resort to unsafe code to change the underlying slice in IoSlice (and IoSliceMut). I'm missing a method that can change the underlying slice. @Nemo157 said that I should open an issue.

Current idea would be something like Buf::advance from the bytes crate.

impl IoSlice {
    // Advance the internal cursors of the slice by `n` bytes.
    fn advance(&mut self, n: usize) {
        // ..
    }
}

Activity

  1. Thomasdezeeuw commented on Jul 16, 2019

    @Thomasdezeeuw
    ContributorAuthor

    Looking for some feedback as to whether this would be accepted.

  2. added a commit that references this issue on Aug 5, 2019
    2e290d3
  3. changed the title [-]Add IoSlice advance or similiar method[/-] [+]Tracking issue for io_slice_advance[/+] on Aug 6, 2019
  4. Thomasdezeeuw commented on Aug 6, 2019

    @Thomasdezeeuw
    ContributorAuthor

    Can someone reopen this as the tracking issue for io_slice_advance? I've updated the the first comment, but I'm not sure it's 100% correct.

  5. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    B-unstableBlocker: Implemented in the nightly compiler and unstable.
    and removed
    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
    on Aug 6, 2019
  6. 82 remaining items

  7. Thomasdezeeuw commented on Aug 2, 2024

    @Thomasdezeeuw
    ContributorAuthor

    I don't think we can guarantee that the method will never be incorrectly used. Same for process::exit for example... I don't know what you expect the standard library to change about this.

  8. zh-jq-b commented on Aug 2, 2024

    @zh-jq-b

    I don't think we can guarantee that the method will never be incorrectly used. Same for process::exit for example... I don't know what you expect the standard library to change about this.

    Before the stabilization of io_slice_advance, users can use both the original buffer and also the iov to get the read data.
    After the stabilization, I'm confused with which one should be used?
    For all old methods that take a IoSliceMut, should I still read the data by using the old way? Will it broken without noticeable API changes?

  9. dead-claudia commented on Aug 3, 2024

    @dead-claudia

    @zh-jq-b Consider filing a bug report against anyone who sets them incorrectly.

    It's not Rust's fault if someone implements read_vectored wrong. It's the fault of whoever wrote the bad implementation for that io::Read trait instance method.

  10. zh-jq-b commented on Aug 6, 2024

    @zh-jq-b

    @zh-jq-b Consider filing a bug report against anyone who sets them incorrectly.

    It's not Rust's fault if someone implements read_vectored wrong. It's the fault of whoever wrote the bad implementation for that io::Read trait instance method.

    The read_vectored should be documented to specify what's the wrong implementation. So I opened #128669 for further confirmation.

  11. added a commit that references this issue on Mar 11, 2025
  12. added
    I-libs-radarLibs issues that are tracked on the team's radar.
    and removed
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Oct 22, 2026
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

    A-ioArea: `std::io` (note: `std::fs`, `std::net`, `std::path` are A-filesystem, A-net, A-path)B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-radarLibs issues that are tracked on the team's radar.T-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