From db22d7d0419f86d44942dcf1b89526429d868566 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 18 Jun 2022 18:35:01 +1000 Subject: [PATCH] Fix codestyle in `async_extracter` Use consistent codestyle for specifing trait bounds. Signed-off-by: Jiahao XU --- src/helpers/async_extracter.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/helpers/async_extracter.rs b/src/helpers/async_extracter.rs index e1448776..2a2a42dd 100644 --- a/src/helpers/async_extracter.rs +++ b/src/helpers/async_extracter.rs @@ -38,11 +38,9 @@ where block_in_place(move || f(readable)) } -pub async fn extract_bin( - stream: impl Stream> + Unpin, - path: &Path, -) -> Result<(), BinstallError> +pub async fn extract_bin(stream: S, path: &Path) -> Result<(), BinstallError> where + S: Stream> + Unpin + 'static, BinstallError: From, { extract_impl(stream, move |mut reader| { @@ -67,11 +65,9 @@ where .await } -pub async fn extract_zip( - stream: impl Stream> + Unpin, - path: &Path, -) -> Result<(), BinstallError> +pub async fn extract_zip(stream: S, path: &Path) -> Result<(), BinstallError> where + S: Stream> + Unpin + 'static, BinstallError: From, { extract_impl(stream, move |mut reader| { @@ -89,12 +85,13 @@ where .await } -pub async fn extract_tar_based_stream( - stream: impl Stream> + Unpin + 'static, +pub async fn extract_tar_based_stream( + stream: S, path: &Path, fmt: TarBasedFmt, ) -> Result<(), BinstallError> where + S: Stream> + Unpin + 'static, BinstallError: From, { extract_impl(stream, move |reader| { @@ -121,12 +118,14 @@ impl TarEntriesVisitor for &mut V { } } -pub async fn extract_tar_based_stream_and_visit( - stream: impl Stream> + Unpin + 'static, +pub async fn extract_tar_based_stream_and_visit( + stream: S, fmt: TarBasedFmt, mut visitor: V, ) -> Result where + S: Stream> + Unpin + 'static, + V: TarEntriesVisitor + Debug + Send + 'static, BinstallError: From, { extract_impl(stream, move |reader| {