pub struct ProgressReporter { /* private fields */ }Expand description
Reports processing progress from a node back to the caller (UI, CLI, etc.).
Wraps an optional boxed closure. Some(callback) for real reporting,
None for no-op mode (used in tests).
Implementations§
Source§impl ProgressReporter
impl ProgressReporter
Sourcepub fn new(callback: impl Fn(u32, &str) + 'static) -> Self
pub fn new(callback: impl Fn(u32, &str) + 'static) -> Self
Create a new ProgressReporter with a callback function.
The callback receives two arguments:
- progress (u32, 0-100) — percentage complete
- message (&str) — human-readable status text
USAGE:
use bnto_core::ProgressReporter;
// Simple logger
let reporter = ProgressReporter::new(|percent, message| {
println!("{}% — {}", percent, message);
});
// In a WASM bridge, wrap a js_sys::Function:
// let reporter = ProgressReporter::new(move |percent, message| {
// let _ = js_callback.call2(&JsValue::NULL, &percent.into(), &message.into());
// });Auto Trait Implementations§
impl Freeze for ProgressReporter
impl !RefUnwindSafe for ProgressReporter
impl !Send for ProgressReporter
impl !Sync for ProgressReporter
impl Unpin for ProgressReporter
impl UnsafeUnpin for ProgressReporter
impl !UnwindSafe for ProgressReporter
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