#[non_exhaustive]pub struct ProgressOptions {
pub on_error: Option<StreamErrorHandler>,
pub on_progress: Option<StreamProgressHandler>,
pub progress_interval: Option<Duration>,
pub progress_items: Option<u64>,
}Expand description
The direction-neutral subset of the dependents’ options structs.
Both StreamBodyAsOptions and ReqwestStreamOptions keep their own definitions, because they
carry direction-specific fields, and neither could add inherent builder methods to a type
defined here (E0116). Each builds one of these internally instead.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.on_error: Option<StreamErrorHandler>Invoked for every error reported by the stream.
on_progress: Option<StreamProgressHandler>Invoked for every progress report.
progress_interval: Option<Duration>How often to report interim progress. None disables the time trigger.
progress_items: Option<u64>Report interim progress every N items. None disables the item trigger.
Implementations§
Source§impl ProgressOptions
impl ProgressOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Default options: report about once a second, no item trigger, no callbacks.
Sourcepub fn on_error(self, handler: StreamErrorHandler) -> Self
pub fn on_error(self, handler: StreamErrorHandler) -> Self
Set the error callback.
Sourcepub fn on_progress(self, handler: StreamProgressHandler) -> Self
pub fn on_progress(self, handler: StreamProgressHandler) -> Self
Set the progress callback.
Sourcepub fn progress_interval(self, interval: Duration) -> Self
pub fn progress_interval(self, interval: Duration) -> Self
Set the interim reporting interval.
Sourcepub fn progress_items(self, items: u64) -> Self
pub fn progress_items(self, items: u64) -> Self
Report interim progress every items items.
Trait Implementations§
Source§impl Clone for ProgressOptions
impl Clone for ProgressOptions
Source§fn clone(&self) -> ProgressOptions
fn clone(&self) -> ProgressOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ProgressOptions
impl !UnwindSafe for ProgressOptions
impl Freeze for ProgressOptions
impl Send for ProgressOptions
impl Sync for ProgressOptions
impl Unpin for ProgressOptions
impl UnsafeUnpin for ProgressOptions
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