pub struct Progress(/* private fields */);Expand description
The accounting handle threaded through one stream’s pipeline.
None inside means nobody is listening and every method is a no-op. Cheap to clone.
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn new(context: &StreamContext, options: &ProgressOptions) -> Self
pub fn new(context: &StreamContext, options: &ProgressOptions) -> Self
Build a handle for one stream.
Call this while the caller’s own tracing span is still current, and before the body is consumed, so the span nests correctly and the context fields are still available.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether anything is listening. Useful to skip work that only feeds reporting.
Sourcepub fn record_item(&self)
pub fn record_item(&self)
Count one item.
A no-op when nobody is listening. Provided for bindings that cannot use
count_items because their pipeline’s item type carries no 'static-ish bound:
applying a combinator would force one onto their public signature.
Sourcepub fn record_bytes(&self, len: u64)
pub fn record_bytes(&self, len: u64)
Count len transferred bytes.
A no-op when nobody is listening. The combinator form is count_bytes.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Progress
impl !UnwindSafe for Progress
impl Freeze for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
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