struct ProgressWriter<'a, 'r> {
file: File,
name: &'a str,
written: u64,
reported: u64,
total: u64,
cancelled: bool,
on_progress: &'a mut (dyn FnMut(Progress) -> ControlFlow<()> + 'r),
}Expand description
Counts bytes on their way to disk and forwards the running total, rate-limited so a multi-gigabyte transfer does not call back once per read.
Fields§
§file: File§name: &'a str§written: u64§reported: u64§total: u64§cancelled: bool§on_progress: &'a mut (dyn FnMut(Progress) -> ControlFlow<()> + 'r)Implementations§
Source§impl ProgressWriter<'_, '_>
impl ProgressWriter<'_, '_>
fn report(&mut self) -> ControlFlow<()>
fn report_now(&mut self) -> Result<(), Error>
Trait Implementations§
Source§impl Write for ProgressWriter<'_, '_>
impl Write for ProgressWriter<'_, '_>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<'a, 'r> !RefUnwindSafe for ProgressWriter<'a, 'r>
impl<'a, 'r> !Send for ProgressWriter<'a, 'r>
impl<'a, 'r> !Sync for ProgressWriter<'a, 'r>
impl<'a, 'r> !UnwindSafe for ProgressWriter<'a, 'r>
impl<'a, 'r> Freeze for ProgressWriter<'a, 'r>
impl<'a, 'r> Unpin for ProgressWriter<'a, 'r>
impl<'a, 'r> UnsafeUnpin for ProgressWriter<'a, 'r>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
§impl<W> WriteSamples for W
impl<W> WriteSamples for W
§fn write_sample<T>(&mut self, sample: &T) -> Result<(), Error>where
T: BytesSample,
fn write_sample<T>(&mut self, sample: &T) -> Result<(), Error>where
T: BytesSample,
Write a single sample to the underlying writer. Read more
§fn write_number<T>(
&mut self,
value: <T as BytesSample>::NumericType,
) -> Result<(), Error>where
T: BytesSample,
fn write_number<T>(
&mut self,
value: <T as BytesSample>::NumericType,
) -> Result<(), Error>where
T: BytesSample,
Write a single sample from a numeric type to the underlying writer. Read more
§fn write_converted<T, U>(&mut self, value: U) -> Result<bool, Error>where
T: RawSample + BytesSample,
U: FloatCore + ToPrimitive,
fn write_converted<T, U>(&mut self, value: U) -> Result<bool, Error>where
T: RawSample + BytesSample,
U: FloatCore + ToPrimitive,
Write a single converted sample to the underlying writer. Read more
§fn write_all_samples<T>(&mut self, samples: &[T]) -> Result<(), Error>where
T: BytesSample,
fn write_all_samples<T>(&mut self, samples: &[T]) -> Result<(), Error>where
T: BytesSample,
Write multiple samples to the underlying writer. Read more
§fn write_all_numbers<T>(
&mut self,
values: &[<T as BytesSample>::NumericType],
) -> Result<(), Error>where
T: BytesSample,
fn write_all_numbers<T>(
&mut self,
values: &[<T as BytesSample>::NumericType],
) -> Result<(), Error>where
T: BytesSample,
Write multiple samples from a numeric slice to the underlying writer. Read more
§fn write_all_converted<T, U>(&mut self, values: &[U]) -> Result<usize, Error>where
T: RawSample + BytesSample,
U: FloatCore + ToPrimitive,
fn write_all_converted<T, U>(&mut self, values: &[U]) -> Result<usize, Error>where
T: RawSample + BytesSample,
U: FloatCore + ToPrimitive,
Write multiple converted samples from a float slice to the underlying writer. Read more