Skip to content

Commit

Permalink
fixup! fix: smooth progress bar for backup transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Oct 5, 2024
1 parent a60e61f commit fe912eb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/imex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,12 @@ struct ProgressReader<R> {
#[pin]
inner: R,

#[pin]
read: usize,

#[pin]
file_size: usize,

#[pin]
last_progress: usize,

#[pin]
context: Context,
}

Expand All @@ -336,7 +332,7 @@ where
cx: &mut std::task::Context<'_>,
buf: &mut ReadBuf<'_>,
) -> std::task::Poll<std::io::Result<()>> {
let mut this = self.project();
let this = self.project();
let before = buf.filled().len();
let res = this.inner.poll_read(cx, buf);
if let std::task::Poll::Ready(Ok(())) = res {
Expand Down Expand Up @@ -514,16 +510,12 @@ struct ProgressWriter<W> {
#[pin]
inner: W,

#[pin]
written: usize,

#[pin]
file_size: usize,

#[pin]
last_progress: usize,

#[pin]
context: Context,
}

Expand All @@ -548,7 +540,7 @@ where
cx: &mut std::task::Context<'_>,
buf: &[u8],
) -> std::task::Poll<Result<usize, std::io::Error>> {
let mut this = self.project();
let this = self.project();
let res = this.inner.poll_write(cx, buf);
if let std::task::Poll::Ready(Ok(written)) = res {
*this.written = this.written.saturating_add(written);
Expand Down

0 comments on commit fe912eb

Please sign in to comment.