mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Rename AsyncExtracter::write
to feed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
432376224f
commit
8a812c8d22
2 changed files with 6 additions and 6 deletions
|
@ -74,7 +74,7 @@ pub async fn download_and_extract<P: AsRef<Path>, const N: usize>(
|
||||||
let mut extracter = AsyncExtracter::new(path, fmt, desired_outputs);
|
let mut extracter = AsyncExtracter::new(path, fmt, desired_outputs);
|
||||||
|
|
||||||
while let Some(res) = bytes_stream.next().await {
|
while let Some(res) = bytes_stream.next().await {
|
||||||
extracter.write(res?).await?;
|
extracter.feed(res?).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
extracter.done().await?;
|
extracter.done().await?;
|
||||||
|
|
|
@ -104,9 +104,9 @@ impl AsyncExtracterInner {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Upon error, this writer shall not be reused.
|
/// Upon error, this extracter shall not be reused.
|
||||||
/// Otherwise, `Self::done` would panic.
|
/// Otherwise, `Self::done` would panic.
|
||||||
async fn write(&mut self, bytes: Bytes) -> Result<(), BinstallError> {
|
async fn feed(&mut self, bytes: Bytes) -> Result<(), BinstallError> {
|
||||||
if self.tx.send(Content::Data(bytes)).await.is_err() {
|
if self.tx.send(Content::Data(bytes)).await.is_err() {
|
||||||
// task failed
|
// task failed
|
||||||
Err(Self::wait(&mut self.handle).await.expect_err(
|
Err(Self::wait(&mut self.handle).await.expect_err(
|
||||||
|
@ -193,10 +193,10 @@ impl AsyncExtracter {
|
||||||
Self(guard(inner, AsyncExtracterInner::abort))
|
Self(guard(inner, AsyncExtracterInner::abort))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Upon error, this writer shall not be reused.
|
/// Upon error, this extracter shall not be reused.
|
||||||
/// Otherwise, `Self::done` would panic.
|
/// Otherwise, `Self::done` would panic.
|
||||||
pub async fn write(&mut self, bytes: Bytes) -> Result<(), BinstallError> {
|
pub async fn feed(&mut self, bytes: Bytes) -> Result<(), BinstallError> {
|
||||||
self.0.write(bytes).await
|
self.0.feed(bytes).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn done(self) -> Result<(), BinstallError> {
|
pub async fn done(self) -> Result<(), BinstallError> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue