Fix codestyle in async_extracter

Use consistent codestyle for specifing trait bounds.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-18 18:35:01 +10:00
parent 53bf76104b
commit db22d7d041
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -38,11 +38,9 @@ where
block_in_place(move || f(readable)) block_in_place(move || f(readable))
} }
pub async fn extract_bin<E>( pub async fn extract_bin<S, E>(stream: S, path: &Path) -> Result<(), BinstallError>
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
path: &Path,
) -> Result<(), BinstallError>
where where
S: Stream<Item = Result<Bytes, E>> + Unpin + 'static,
BinstallError: From<E>, BinstallError: From<E>,
{ {
extract_impl(stream, move |mut reader| { extract_impl(stream, move |mut reader| {
@ -67,11 +65,9 @@ where
.await .await
} }
pub async fn extract_zip<E>( pub async fn extract_zip<S, E>(stream: S, path: &Path) -> Result<(), BinstallError>
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
path: &Path,
) -> Result<(), BinstallError>
where where
S: Stream<Item = Result<Bytes, E>> + Unpin + 'static,
BinstallError: From<E>, BinstallError: From<E>,
{ {
extract_impl(stream, move |mut reader| { extract_impl(stream, move |mut reader| {
@ -89,12 +85,13 @@ where
.await .await
} }
pub async fn extract_tar_based_stream<E>( pub async fn extract_tar_based_stream<S, E>(
stream: impl Stream<Item = Result<Bytes, E>> + Unpin + 'static, stream: S,
path: &Path, path: &Path,
fmt: TarBasedFmt, fmt: TarBasedFmt,
) -> Result<(), BinstallError> ) -> Result<(), BinstallError>
where where
S: Stream<Item = Result<Bytes, E>> + Unpin + 'static,
BinstallError: From<E>, BinstallError: From<E>,
{ {
extract_impl(stream, move |reader| { extract_impl(stream, move |reader| {
@ -121,12 +118,14 @@ impl<V: TarEntriesVisitor> TarEntriesVisitor for &mut V {
} }
} }
pub async fn extract_tar_based_stream_and_visit<V: TarEntriesVisitor + Debug + Send + 'static, E>( pub async fn extract_tar_based_stream_and_visit<S, V, E>(
stream: impl Stream<Item = Result<Bytes, E>> + Unpin + 'static, stream: S,
fmt: TarBasedFmt, fmt: TarBasedFmt,
mut visitor: V, mut visitor: V,
) -> Result<V, BinstallError> ) -> Result<V, BinstallError>
where where
S: Stream<Item = Result<Bytes, E>> + Unpin + 'static,
V: TarEntriesVisitor + Debug + Send + 'static,
BinstallError: From<E>, BinstallError: From<E>,
{ {
extract_impl(stream, move |reader| { extract_impl(stream, move |reader| {