pub struct TaskProgressShared { /* private fields */ }Expand description
Shared version of TaskProgress which does not provide any mutable access
to it’s fields.
It can be accessed via Caller::Progressing.
// We need to define a progress type and implement `Progress` for it.
struct UnitProgress;
impl Progress for UnitProgress {
fn apply(&self, current: &mut u32) {
*current += 1;
}
}
Caller::progressing(|progress| async move {
// Set the total number of items or steps that needs to be completed
// eg. number of items in the downloading.
progress.set_total(5);
// Now we can use our type.
let _ = progress.update(UnitProgress);
});Implementations§
Auto Trait Implementations§
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