pub struct HistoryOptions {
pub start_index: Option<u16>,
pub end_index: Option<u16>,
pub read_delay: Duration,
pub progress_callback: Option<ProgressCallback>,
}Expand description
Options for downloading history.
§Index Convention
Indices are 1-based to match the Aranet device protocol:
start_index: Some(1)means the first (oldest) readingend_index: Some(100)means the 100th readingstart_index: Nonedefaults to 1 (beginning)end_index: Nonedefaults to total_readings (end)
§Progress Reporting
Use with_progress to receive updates during download:
ⓘ
let options = HistoryOptions::default()
.with_progress(|p| println!("Progress: {:.1}%", p.overall_progress * 100.0));Fields§
§start_index: Option<u16>Starting index (1-based, inclusive). If None, downloads from the beginning (index 1).
end_index: Option<u16>Ending index (1-based, inclusive). If None, downloads to the end (index = total_readings).
read_delay: DurationDelay between read operations to avoid overwhelming the device.
progress_callback: Option<ProgressCallback>Progress callback (optional).
Implementations§
Source§impl HistoryOptions
impl HistoryOptions
Sourcepub fn start_index(self, index: u16) -> Self
pub fn start_index(self, index: u16) -> Self
Set the starting index (1-based).
Sourcepub fn read_delay(self, delay: Duration) -> Self
pub fn read_delay(self, delay: Duration) -> Self
Set the delay between read operations.
Sourcepub fn with_progress<F>(self, callback: F) -> Self
pub fn with_progress<F>(self, callback: F) -> Self
Set a progress callback.
Sourcepub fn report_progress(&self, progress: &HistoryProgress)
pub fn report_progress(&self, progress: &HistoryProgress)
Report progress if a callback is set.
Trait Implementations§
Source§impl Clone for HistoryOptions
impl Clone for HistoryOptions
Source§fn clone(&self) -> HistoryOptions
fn clone(&self) -> HistoryOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HistoryOptions
impl Debug for HistoryOptions
Auto Trait Implementations§
impl Freeze for HistoryOptions
impl !RefUnwindSafe for HistoryOptions
impl Send for HistoryOptions
impl Sync for HistoryOptions
impl Unpin for HistoryOptions
impl !UnwindSafe for HistoryOptions
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