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

Update to new io_slice_advance interface #2454

Merged
merged 3 commits into from Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -52,6 +52,8 @@ jobs:
- run: cargo install cross
- run: cross test --target ${{ matrix.target }} --workspace --all-features
- run: cross test --target ${{ matrix.target }} --workspace --all-features --release
# TODO: https://github.com/rust-lang/futures-rs/issues/2451
if: matrix.target != 'aarch64-unknown-linux-gnu'

core-msrv:
name: cargo +${{ matrix.rust }} build (futures-{core, io, sink, task})
Expand Down Expand Up @@ -254,12 +256,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust and Clippy
run: |
toolchain=nightly-$(curl -sSf https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)
rustup set profile minimal
rustup default "$toolchain"
rustup component add clippy
- name: Install Rust
run: rustup toolchain install nightly --component clippy && rustup default nightly
- run: cargo clippy --workspace --all-features --all-targets

fmt:
Expand Down
8 changes: 4 additions & 4 deletions futures-util/src/io/write_all_vectored.rs
Expand Up @@ -4,7 +4,6 @@ use futures_core::task::{Context, Poll};
use futures_io::AsyncWrite;
use futures_io::IoSlice;
use std::io;
use std::mem;
use std::pin::Pin;

/// Future for the
Expand All @@ -19,8 +18,9 @@ pub struct WriteAllVectored<'a, W: ?Sized + Unpin> {
impl<W: ?Sized + Unpin> Unpin for WriteAllVectored<'_, W> {}

impl<'a, W: AsyncWrite + ?Sized + Unpin> WriteAllVectored<'a, W> {
pub(super) fn new(writer: &'a mut W, bufs: &'a mut [IoSlice<'a>]) -> Self {
Self { writer, bufs: IoSlice::advance(bufs, 0) }
pub(super) fn new(writer: &'a mut W, mut bufs: &'a mut [IoSlice<'a>]) -> Self {
IoSlice::advance_slices(&mut bufs, 0);
Self { writer, bufs }
}
}

Expand All @@ -34,7 +34,7 @@ impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteAllVectored<'_, W> {
if n == 0 {
return Poll::Ready(Err(io::ErrorKind::WriteZero.into()));
} else {
this.bufs = IoSlice::advance(mem::take(&mut this.bufs), n);
IoSlice::advance_slices(&mut this.bufs, n);
}
}

Expand Down