Skip to main content

ReadOptions

Struct ReadOptions 

Source
pub struct ReadOptions {
    pub group: Option<String>,
    pub start_time: Option<f64>,
    pub end_time: Option<f64>,
    pub start_record: Option<u64>,
    pub record_count: Option<u64>,
    pub raw: bool,
}
Expand description

Options for read / values: which group to look in, and which part of the channel to read.

Select either a time window (start_time / end_time, inclusive, in the master channel’s unit — seconds relative to the measurement start for a time master) or a record window (start_record / record_count). Omitted bounds are open.

use mf4_rs::ReadOptions;
let opts = ReadOptions::new().group("Engine").time(Some(1.0), Some(2.5));
let page = ReadOptions::new().records(1_000, 500);
let stored = ReadOptions::new().raw(true); // skip the conversion

raw returns the values as stored in the file, without the channel’s conversion (a linear channel gives its stored numbers, a value-to-text channel its keys instead of the texts). Only the requested channel is affected: timestamps and time windows still use the physical (converted) time axis. unit is the channel’s (physical) unit, unchanged.

Fields§

§group: Option<String>

Group name, to disambiguate a channel name used by several groups.

§start_time: Option<f64>

Inclusive lower time bound.

§end_time: Option<f64>

Inclusive upper time bound.

§start_record: Option<u64>

First record of a record window (0-based).

§record_count: Option<u64>

Number of records in a record window.

§raw: bool

Return the stored values, without applying the channel’s conversion.

Implementations§

Source§

impl ReadOptions

Source

pub fn new() -> Self

Options selecting the whole channel, first match across all groups.

Source

pub fn group(self, group: impl Into<String>) -> Self

Restrict the lookup to the group(s) with this name.

Source

pub fn time(self, start: Option<f64>, end: Option<f64>) -> Self

Select samples whose master (time) value lies in [start, end].

Source

pub fn records(self, start: u64, count: u64) -> Self

Select records [start, start + count).

Source

pub fn raw(self, raw: bool) -> Self

Return the values as stored, without the channel’s conversion.

Source

pub fn from_parts( group: Option<&str>, start_time: Option<f64>, end_time: Option<f64>, start_record: Option<u64>, record_count: Option<u64>, ) -> Self

Build options from the flat optional arguments the bindings take.

Trait Implementations§

Source§

impl Clone for ReadOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ReadOptions

Source§

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

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

impl Default for ReadOptions

Source§

fn default() -> Self

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

impl PartialEq for ReadOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ReadOptions

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.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.