aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:06:16 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:06:16 +0000
commitf633e8eaadeaf4ada44122904a1a5307c04d2931 (patch)
treeffd532becddffbdad4319049ca6dde2db128d5e4
parent9ab498c0550a8b17c14a2709dc1fca0d2eb15603 (diff)
parent7d19bccfe157d2a9d2872530f6d7602a8d7742de (diff)
downloadfutures-io-android13-mainline-media-swcodec-release.tar.gz
Change-Id: I7dee519700ce43a7dc8ea1b2a117b4d2ea5d112c
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--Android.bp29
-rw-r--r--Cargo.toml25
-rw-r--r--Cargo.toml.orig6
-rw-r--r--METADATA8
-rw-r--r--README.md23
-rw-r--r--TEST_MAPPING52
-rw-r--r--cargo2android.json5
-rw-r--r--src/lib.rs239
9 files changed, 187 insertions, 207 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index f3ad3ab..3d43471 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
{
"git": {
- "sha1": "c91f8691672c7401b1923ab00bf138975c99391a"
- }
-}
+ "sha1": "fc1e3250219170e31cddb8857a276cba7dd08d44"
+ },
+ "path_in_vcs": "futures-io"
+} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index fa20cd8..ba96032 100644
--- a/Android.bp
+++ b/Android.bp
@@ -37,36 +37,12 @@ license {
],
}
-rust_defaults {
- name: "futures-io_defaults",
- crate_name: "futures_io",
- srcs: ["src/lib.rs"],
- test_suites: ["general-tests"],
- auto_gen_config: true,
- edition: "2018",
- features: [
- "default",
- "std",
- ],
-}
-
-rust_test_host {
- name: "futures-io_host_test_src_lib",
- defaults: ["futures-io_defaults"],
- test_options: {
- unit_test: true,
- },
-}
-
-rust_test {
- name: "futures-io_device_test_src_lib",
- defaults: ["futures-io_defaults"],
-}
-
rust_library {
name: "libfutures_io",
host_supported: true,
crate_name: "futures_io",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.3.21",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
@@ -75,6 +51,7 @@ rust_library {
],
apex_available: [
"//apex_available:platform",
+ "com.android.bluetooth",
"com.android.resolv",
"com.android.virt",
],
diff --git a/Cargo.toml b/Cargo.toml
index 0cf53b7..9494c45 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,31 +3,34 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
+rust-version = "1.36"
name = "futures-io"
-version = "0.3.13"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
-description = "The `AsyncRead`, `AsyncWrite`, `AsyncSeek`, and `AsyncBufRead` traits for the futures-rs library.\n"
+version = "0.3.21"
+description = """
+The `AsyncRead`, `AsyncWrite`, `AsyncSeek`, and `AsyncBufRead` traits for the futures-rs library.
+"""
homepage = "https://rust-lang.github.io/futures-rs"
-documentation = "https://docs.rs/futures-io/0.3"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
+
[package.metadata.docs.rs]
all-features = true
-rustdoc-args = ["--cfg", "docsrs"]
+rustdoc-args = [
+ "--cfg",
+ "docsrs",
+]
[dependencies]
[features]
default = ["std"]
-read-initializer = []
std = []
unstable = []
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 2edbdc3..8d44694 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,12 +1,11 @@
[package]
name = "futures-io"
+version = "0.3.21"
edition = "2018"
-version = "0.3.13"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
+rust-version = "1.36"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
-documentation = "https://docs.rs/futures-io/0.3"
description = """
The `AsyncRead`, `AsyncWrite`, `AsyncSeek`, and `AsyncBufRead` traits for the futures-rs library.
"""
@@ -19,7 +18,6 @@ std = []
# These features are outside of the normal semver guarantees and require the
# `unstable` feature as an explicit opt-in to unstable API.
unstable = []
-read-initializer = []
[dependencies]
diff --git a/METADATA b/METADATA
index 64097af..5de28ef 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/futures-io/futures-io-0.3.13.crate"
+ value: "https://static.crates.io/crates/futures-io/futures-io-0.3.21.crate"
}
- version: "0.3.13"
+ version: "0.3.21"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 4
+ year: 2022
+ month: 3
day: 1
}
}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..da6eec2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+# futures-io
+
+The `AsyncRead`, `AsyncWrite`, `AsyncSeek`, and `AsyncBufRead` traits for the futures-rs library.
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+futures-io = "0.3"
+```
+
+The current `futures-io` requires Rust 1.36 or later.
+
+## License
+
+Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
+[MIT license](LICENSE-MIT) at your option.
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall
+be dual licensed as above, without any additional terms or conditions.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 568eaf7..5ef61de 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,59 +1,45 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "presubmit": [
- {
- "name": "anyhow_device_test_tests_test_repr"
- },
- {
- "name": "anyhow_device_test_tests_test_context"
- },
- {
- "name": "anyhow_device_test_tests_test_convert"
- },
- {
- "name": "futures-io_device_test_src_lib"
- },
+ "imports": [
{
- "name": "tokio-test_device_test_tests_block_on"
+ "path": "external/rust/crates/anyhow"
},
{
- "name": "tokio-test_device_test_tests_io"
+ "path": "external/rust/crates/futures-util"
},
{
- "name": "tokio-test_device_test_tests_macros"
+ "path": "external/rust/crates/tokio"
},
{
- "name": "anyhow_device_test_tests_test_downcast"
- },
- {
- "name": "anyhow_device_test_tests_test_fmt"
- },
- {
- "name": "futures-util_device_test_src_lib"
- },
+ "path": "external/rust/crates/tokio-test"
+ }
+ ],
+ "presubmit": [
{
- "name": "anyhow_device_test_tests_test_autotrait"
+ "name": "ZipFuseTest"
},
{
- "name": "anyhow_device_test_src_lib"
+ "name": "authfs_device_test_src_lib"
},
{
- "name": "tokio-test_device_test_src_lib"
+ "name": "doh_unit_test"
},
{
- "name": "anyhow_device_test_tests_test_source"
- },
+ "name": "virtualizationservice_device_test"
+ }
+ ],
+ "presubmit-rust": [
{
- "name": "anyhow_device_test_tests_test_ffi"
+ "name": "ZipFuseTest"
},
{
- "name": "anyhow_device_test_tests_test_macros"
+ "name": "authfs_device_test_src_lib"
},
{
- "name": "anyhow_device_test_tests_test_chain"
+ "name": "doh_unit_test"
},
{
- "name": "anyhow_device_test_tests_test_boxed"
+ "name": "virtualizationservice_device_test"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
index 44e747c..5b266a6 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,12 +1,13 @@
{
"apex-available": [
"//apex_available:platform",
+ "com.android.bluetooth",
"com.android.resolv",
"com.android.virt"
],
- "min_sdk_version": "29",
"dependencies": true,
"device": true,
+ "min-sdk-version": "29",
"run": true,
"tests": true
-} \ No newline at end of file
+}
diff --git a/src/lib.rs b/src/lib.rs
index 48de896..e91eb78 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,21 +8,19 @@
//! All items of this library are only available when the `std` feature of this
//! library is activated, and it is activated by default.
-#![cfg_attr(all(feature = "read-initializer", feature = "std"), feature(read_initializer))]
-
#![cfg_attr(not(feature = "std"), no_std)]
-
-#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
+#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)]
// It cannot be included in the published code because this lints have false positives in the minimum required version.
#![cfg_attr(test, warn(single_use_lifetimes))]
-#![warn(clippy::all)]
-#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
-
+#![doc(test(
+ no_crate_inject,
+ attr(
+ deny(warnings, rust_2018_idioms, single_use_lifetimes),
+ allow(dead_code, unused_assignments, unused_variables)
+ )
+))]
#![cfg_attr(docsrs, feature(doc_cfg))]
-#[cfg(all(feature = "read-initializer", not(feature = "unstable")))]
-compile_error!("The `read-initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features");
-
#[cfg(feature = "std")]
mod if_std {
use std::io;
@@ -34,12 +32,7 @@ mod if_std {
// with conflicts when `use`ing `futures::io` and `std::io`.
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
#[doc(no_inline)]
- pub use io::{Error, ErrorKind, Result, IoSlice, IoSliceMut, SeekFrom};
- #[cfg(feature = "read-initializer")]
- #[cfg_attr(docsrs, doc(cfg(feature = "read-initializer")))]
- #[doc(no_inline)]
- #[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
- pub use io::Initializer;
+ pub use io::{Error, ErrorKind, IoSlice, IoSliceMut, Result, SeekFrom};
/// Read bytes asynchronously.
///
@@ -49,27 +42,6 @@ mod if_std {
/// for wakeup and return if data is not yet available, rather than blocking
/// the calling thread.
pub trait AsyncRead {
- /// Determines if this `AsyncRead`er can work with buffers of
- /// uninitialized memory.
- ///
- /// The default implementation returns an initializer which will zero
- /// buffers.
- ///
- /// This method is only available when the `read-initializer` feature of this
- /// library is activated.
- ///
- /// # Safety
- ///
- /// This method is `unsafe` because an `AsyncRead`er could otherwise
- /// return a non-zeroing `Initializer` from another `AsyncRead` type
- /// without an `unsafe` block.
- #[cfg(feature = "read-initializer")]
- #[cfg_attr(docsrs, doc(cfg(feature = "read-initializer")))]
- #[inline]
- unsafe fn initializer(&self) -> Initializer {
- Initializer::zeroing()
- }
-
/// Attempt to read from the `AsyncRead` into `buf`.
///
/// On success, returns `Poll::Ready(Ok(num_bytes_read))`.
@@ -85,8 +57,11 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
- fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8])
- -> Poll<Result<usize>>;
+ fn poll_read(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &mut [u8],
+ ) -> Poll<Result<usize>>;
/// Attempt to read from the `AsyncRead` into `bufs` using vectored
/// IO operations.
@@ -110,9 +85,11 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
- fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_read_vectored(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &mut [IoSliceMut<'_>],
+ ) -> Poll<Result<usize>> {
for b in bufs {
if !b.is_empty() {
return self.poll_read(cx, b);
@@ -149,8 +126,11 @@ mod if_std {
///
/// `poll_write` must try to make progress by flushing the underlying object if
/// that is the only way the underlying object can become writable again.
- fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8])
- -> Poll<Result<usize>>;
+ fn poll_write(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &[u8],
+ ) -> Poll<Result<usize>>;
/// Attempt to write bytes from `bufs` into the object using vectored
/// IO operations.
@@ -175,9 +155,11 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
- fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_write_vectored(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &[IoSlice<'_>],
+ ) -> Poll<Result<usize>> {
for b in bufs {
if !b.is_empty() {
return self.poll_write(cx, b);
@@ -252,8 +234,11 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
- fn poll_seek(self: Pin<&mut Self>, cx: &mut Context<'_>, pos: SeekFrom)
- -> Poll<Result<u64>>;
+ fn poll_seek(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ pos: SeekFrom,
+ ) -> Poll<Result<u64>>;
}
/// Read bytes asynchronously.
@@ -292,8 +277,7 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
- fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
- -> Poll<Result<&[u8]>>;
+ fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<&[u8]>>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer,
/// so they should no longer be returned in calls to [`poll_read`].
@@ -315,23 +299,22 @@ mod if_std {
macro_rules! deref_async_read {
() => {
- #[cfg(feature = "read-initializer")]
- unsafe fn initializer(&self) -> Initializer {
- (**self).initializer()
- }
-
- fn poll_read(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8])
- -> Poll<Result<usize>>
- {
+ fn poll_read(
+ mut self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &mut [u8],
+ ) -> Poll<Result<usize>> {
Pin::new(&mut **self).poll_read(cx, buf)
}
- fn poll_read_vectored(mut self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_read_vectored(
+ mut self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &mut [IoSliceMut<'_>],
+ ) -> Poll<Result<usize>> {
Pin::new(&mut **self).poll_read_vectored(cx, bufs)
}
- }
+ };
}
impl<T: ?Sized + AsyncRead + Unpin> AsyncRead for Box<T> {
@@ -347,43 +330,41 @@ mod if_std {
P: DerefMut + Unpin,
P::Target: AsyncRead,
{
- #[cfg(feature = "read-initializer")]
- unsafe fn initializer(&self) -> Initializer {
- (**self).initializer()
- }
-
- fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8])
- -> Poll<Result<usize>>
- {
+ fn poll_read(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &mut [u8],
+ ) -> Poll<Result<usize>> {
self.get_mut().as_mut().poll_read(cx, buf)
}
- fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_read_vectored(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &mut [IoSliceMut<'_>],
+ ) -> Poll<Result<usize>> {
self.get_mut().as_mut().poll_read_vectored(cx, bufs)
}
}
macro_rules! delegate_async_read_to_stdio {
() => {
- #[cfg(feature = "read-initializer")]
- unsafe fn initializer(&self) -> Initializer {
- io::Read::initializer(self)
- }
-
- fn poll_read(mut self: Pin<&mut Self>, _: &mut Context<'_>, buf: &mut [u8])
- -> Poll<Result<usize>>
- {
+ fn poll_read(
+ mut self: Pin<&mut Self>,
+ _: &mut Context<'_>,
+ buf: &mut [u8],
+ ) -> Poll<Result<usize>> {
Poll::Ready(io::Read::read(&mut *self, buf))
}
- fn poll_read_vectored(mut self: Pin<&mut Self>, _: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_read_vectored(
+ mut self: Pin<&mut Self>,
+ _: &mut Context<'_>,
+ bufs: &mut [IoSliceMut<'_>],
+ ) -> Poll<Result<usize>> {
Poll::Ready(io::Read::read_vectored(&mut *self, bufs))
}
- }
+ };
}
impl AsyncRead for &[u8] {
@@ -392,15 +373,19 @@ mod if_std {
macro_rules! deref_async_write {
() => {
- fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8])
- -> Poll<Result<usize>>
- {
+ fn poll_write(
+ mut self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &[u8],
+ ) -> Poll<Result<usize>> {
Pin::new(&mut **self).poll_write(cx, buf)
}
- fn poll_write_vectored(mut self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_write_vectored(
+ mut self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &[IoSlice<'_>],
+ ) -> Poll<Result<usize>> {
Pin::new(&mut **self).poll_write_vectored(cx, bufs)
}
@@ -411,7 +396,7 @@ mod if_std {
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>> {
Pin::new(&mut **self).poll_close(cx)
}
- }
+ };
}
impl<T: ?Sized + AsyncWrite + Unpin> AsyncWrite for Box<T> {
@@ -427,15 +412,19 @@ mod if_std {
P: DerefMut + Unpin,
P::Target: AsyncWrite,
{
- fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8])
- -> Poll<Result<usize>>
- {
+ fn poll_write(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ buf: &[u8],
+ ) -> Poll<Result<usize>> {
self.get_mut().as_mut().poll_write(cx, buf)
}
- fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_write_vectored(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ bufs: &[IoSlice<'_>],
+ ) -> Poll<Result<usize>> {
self.get_mut().as_mut().poll_write_vectored(cx, bufs)
}
@@ -450,15 +439,19 @@ mod if_std {
macro_rules! delegate_async_write_to_stdio {
() => {
- fn poll_write(mut self: Pin<&mut Self>, _: &mut Context<'_>, buf: &[u8])
- -> Poll<Result<usize>>
- {
+ fn poll_write(
+ mut self: Pin<&mut Self>,
+ _: &mut Context<'_>,
+ buf: &[u8],
+ ) -> Poll<Result<usize>> {
Poll::Ready(io::Write::write(&mut *self, buf))
}
- fn poll_write_vectored(mut self: Pin<&mut Self>, _: &mut Context<'_>, bufs: &[IoSlice<'_>])
- -> Poll<Result<usize>>
- {
+ fn poll_write_vectored(
+ mut self: Pin<&mut Self>,
+ _: &mut Context<'_>,
+ bufs: &[IoSlice<'_>],
+ ) -> Poll<Result<usize>> {
Poll::Ready(io::Write::write_vectored(&mut *self, bufs))
}
@@ -469,7 +462,7 @@ mod if_std {
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>> {
self.poll_flush(cx)
}
- }
+ };
}
impl AsyncWrite for Vec<u8> {
@@ -478,12 +471,14 @@ mod if_std {
macro_rules! deref_async_seek {
() => {
- fn poll_seek(mut self: Pin<&mut Self>, cx: &mut Context<'_>, pos: SeekFrom)
- -> Poll<Result<u64>>
- {
+ fn poll_seek(
+ mut self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ pos: SeekFrom,
+ ) -> Poll<Result<u64>> {
Pin::new(&mut **self).poll_seek(cx, pos)
}
- }
+ };
}
impl<T: ?Sized + AsyncSeek + Unpin> AsyncSeek for Box<T> {
@@ -499,25 +494,25 @@ mod if_std {
P: DerefMut + Unpin,
P::Target: AsyncSeek,
{
- fn poll_seek(self: Pin<&mut Self>, cx: &mut Context<'_>, pos: SeekFrom)
- -> Poll<Result<u64>>
- {
+ fn poll_seek(
+ self: Pin<&mut Self>,
+ cx: &mut Context<'_>,
+ pos: SeekFrom,
+ ) -> Poll<Result<u64>> {
self.get_mut().as_mut().poll_seek(cx, pos)
}
}
macro_rules! deref_async_buf_read {
() => {
- fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
- -> Poll<Result<&[u8]>>
- {
+ fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<&[u8]>> {
Pin::new(&mut **self.get_mut()).poll_fill_buf(cx)
}
fn consume(mut self: Pin<&mut Self>, amt: usize) {
Pin::new(&mut **self).consume(amt)
}
- }
+ };
}
impl<T: ?Sized + AsyncBufRead + Unpin> AsyncBufRead for Box<T> {
@@ -533,9 +528,7 @@ mod if_std {
P: DerefMut + Unpin,
P::Target: AsyncBufRead,
{
- fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
- -> Poll<Result<&[u8]>>
- {
+ fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<&[u8]>> {
self.get_mut().as_mut().poll_fill_buf(cx)
}
@@ -546,16 +539,14 @@ mod if_std {
macro_rules! delegate_async_buf_read_to_stdio {
() => {
- fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>)
- -> Poll<Result<&[u8]>>
- {
+ fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<&[u8]>> {
Poll::Ready(io::BufRead::fill_buf(self.get_mut()))
}
fn consume(self: Pin<&mut Self>, amt: usize) {
io::BufRead::consume(self.get_mut(), amt)
}
- }
+ };
}
impl AsyncBufRead for &[u8] {