Skip to content

Commit

Permalink
Rollup merge of rust-lang#127661 - eduardosm:stabilize-io_slice_advan…
Browse files Browse the repository at this point in the history
…ce, r=cuviper

Stabilize io_slice_advance

Closes rust-lang#62726 (FCP completed)

Stabilized API:

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

impl<'a> IoSliceMut<'a> {
    pub fn advance(&mut self, n: usize);
    pub fn advance_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize);
}
```
  • Loading branch information
jhpratt authored Jul 13, 2024
2 parents 206678c + 6e26e27 commit 1e49e05
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,8 +1256,6 @@ impl<'a> IoSliceMut<'a> {
/// # Examples
///
/// ```
/// #![feature(io_slice_advance)]
///
/// use std::io::IoSliceMut;
/// use std::ops::Deref;
///
Expand All @@ -1268,7 +1266,7 @@ impl<'a> IoSliceMut<'a> {
/// buf.advance(3);
/// assert_eq!(buf.deref(), [1; 5].as_ref());
/// ```
#[unstable(feature = "io_slice_advance", issue = "62726")]
#[stable(feature = "io_slice_advance", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub fn advance(&mut self, n: usize) {
self.0.advance(n)
Expand All @@ -1290,8 +1288,6 @@ impl<'a> IoSliceMut<'a> {
/// # Examples
///
/// ```
/// #![feature(io_slice_advance)]
///
/// use std::io::IoSliceMut;
/// use std::ops::Deref;
///
Expand All @@ -1309,7 +1305,7 @@ impl<'a> IoSliceMut<'a> {
/// assert_eq!(bufs[0].deref(), [2; 14].as_ref());
/// assert_eq!(bufs[1].deref(), [3; 8].as_ref());
/// ```
#[unstable(feature = "io_slice_advance", issue = "62726")]
#[stable(feature = "io_slice_advance", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub fn advance_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize) {
// Number of buffers to remove.
Expand Down Expand Up @@ -1400,8 +1396,6 @@ impl<'a> IoSlice<'a> {
/// # Examples
///
/// ```
/// #![feature(io_slice_advance)]
///
/// use std::io::IoSlice;
/// use std::ops::Deref;
///
Expand All @@ -1412,7 +1406,7 @@ impl<'a> IoSlice<'a> {
/// buf.advance(3);
/// assert_eq!(buf.deref(), [1; 5].as_ref());
/// ```
#[unstable(feature = "io_slice_advance", issue = "62726")]
#[stable(feature = "io_slice_advance", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub fn advance(&mut self, n: usize) {
self.0.advance(n)
Expand All @@ -1434,8 +1428,6 @@ impl<'a> IoSlice<'a> {
/// # Examples
///
/// ```
/// #![feature(io_slice_advance)]
///
/// use std::io::IoSlice;
/// use std::ops::Deref;
///
Expand All @@ -1452,7 +1444,7 @@ impl<'a> IoSlice<'a> {
/// IoSlice::advance_slices(&mut bufs, 10);
/// assert_eq!(bufs[0].deref(), [2; 14].as_ref());
/// assert_eq!(bufs[1].deref(), [3; 8].as_ref());
#[unstable(feature = "io_slice_advance", issue = "62726")]
#[stable(feature = "io_slice_advance", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub fn advance_slices(bufs: &mut &mut [IoSlice<'a>], n: usize) {
// Number of buffers to remove.
Expand Down

0 comments on commit 1e49e05

Please sign in to comment.