pub struct UploadProgress { /* private fields */ }Expand description
Upload progress middleware configuration.
§Examples
use tako::middleware::upload_progress::UploadProgress;
use tako::middleware::IntoMiddleware;
// Simple progress tracking (access via ProgressTracker in extensions)
let progress = UploadProgress::new();
// With progress callback
let progress = UploadProgress::new()
.on_progress(|state| {
if let Some(pct) = state.percent() {
println!("Upload: {pct}%");
}
})
.min_notify_interval_bytes(8192); // notify at most every 8KBImplementations§
Source§impl UploadProgress
impl UploadProgress
Sourcepub fn on_progress<F>(self, f: F) -> Self
pub fn on_progress<F>(self, f: F) -> Self
Sets a callback that is called as bytes are received.
Sourcepub fn min_notify_interval_bytes(self, bytes: u64) -> Self
pub fn min_notify_interval_bytes(self, bytes: u64) -> Self
Sets the minimum byte interval between progress notifications.
This prevents the callback from being called too frequently for large uploads. Default is 0 (notify on every chunk).
Trait Implementations§
Source§impl Default for UploadProgress
impl Default for UploadProgress
Auto Trait Implementations§
impl Freeze for UploadProgress
impl !RefUnwindSafe for UploadProgress
impl Send for UploadProgress
impl Sync for UploadProgress
impl Unpin for UploadProgress
impl UnsafeUnpin for UploadProgress
impl !UnwindSafe for UploadProgress
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