Struct HistoryOptions

Source
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) reading
  • end_index: Some(100) means the 100th reading
  • start_index: None defaults to 1 (beginning)
  • end_index: None defaults 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: Duration

Delay between read operations to avoid overwhelming the device.

§progress_callback: Option<ProgressCallback>

Progress callback (optional).

Implementations§

Source§

impl HistoryOptions

Source

pub fn new() -> Self

Create new history options with default settings.

Source

pub fn start_index(self, index: u16) -> Self

Set the starting index (1-based).

Source

pub fn end_index(self, index: u16) -> Self

Set the ending index (1-based).

Source

pub fn read_delay(self, delay: Duration) -> Self

Set the delay between read operations.

Source

pub fn with_progress<F>(self, callback: F) -> Self
where F: Fn(HistoryProgress) + Send + Sync + 'static,

Set a progress callback.

Source

pub fn report_progress(&self, progress: &HistoryProgress)

Report progress if a callback is set.

Trait Implementations§

Source§

impl Clone for HistoryOptions

Source§

fn clone(&self) -> HistoryOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HistoryOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HistoryOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more