Struct iroh_blobs::util::progress::ProgressSliceWriter
source · pub struct ProgressSliceWriter<W, F>(/* private fields */);
Expand description
A slice writer that adds a synchronous progress callback.
This wraps any AsyncSliceWriter
, passes through all operations to the inner writer, and
calls the passed on_write
callback whenever data is written.
Implementations§
source§impl<W: AsyncSliceWriter, F: FnMut(u64)> ProgressSliceWriter<W, F>
impl<W: AsyncSliceWriter, F: FnMut(u64)> ProgressSliceWriter<W, F>
sourcepub fn new(inner: W, on_write: F) -> Self
pub fn new(inner: W, on_write: F) -> Self
Create a new ProgressSliceWriter
from an inner writer and a progress callback
The on_write
function is called for each write, with the offset
as the first and the
length of the data as the second param.
sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Return the inner writer
Trait Implementations§
source§impl<W: AsyncSliceWriter + 'static, F: FnMut(u64, usize) + 'static> AsyncSliceWriter for ProgressSliceWriter<W, F>
impl<W: AsyncSliceWriter + 'static, F: FnMut(u64, usize) + 'static> AsyncSliceWriter for ProgressSliceWriter<W, F>
Auto Trait Implementations§
impl<W, F> Freeze for ProgressSliceWriter<W, F>
impl<W, F> RefUnwindSafe for ProgressSliceWriter<W, F>where
W: RefUnwindSafe,
F: RefUnwindSafe,
impl<W, F> Send for ProgressSliceWriter<W, F>
impl<W, F> Sync for ProgressSliceWriter<W, F>
impl<W, F> Unpin for ProgressSliceWriter<W, F>
impl<W, F> UnwindSafe for ProgressSliceWriter<W, F>where
W: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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