pub struct WaitOptions {
pub interval_ms: u64,
pub timeout_ms: u64,
pub on_progress: Option<Box<dyn Fn(&JobStatusResponse) + Send>>,
}Expand description
Controls the polling behaviour of capture_*_and_wait methods.
§Example
use screenshotfreeapi::WaitOptions;
let opts = WaitOptions {
interval_ms: 1_500,
timeout_ms: 60_000,
on_progress: Some(Box::new(|s| {
println!("Job {} — {}%", s.job_id, s.progress.unwrap_or(0));
})),
};Fields§
§interval_ms: u64How long to sleep between status polls, in milliseconds. Default: 2 000.
timeout_ms: u64Maximum total time to wait before returning ScreenshotFreeAPIError::JobTimeout, in milliseconds. Default: 120 000.
on_progress: Option<Box<dyn Fn(&JobStatusResponse) + Send>>Optional callback invoked after each status poll. Useful for progress indicators.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WaitOptions
impl !Sync for WaitOptions
impl !UnwindSafe for WaitOptions
impl Freeze for WaitOptions
impl Send for WaitOptions
impl Unpin for WaitOptions
impl UnsafeUnpin for WaitOptions
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