Skip to main content

TimeSeriesReader

Struct TimeSeriesReader 

Source
pub struct TimeSeriesReader<T> { /* private fields */ }
Expand description

Unevenly-sampled time series reader.

Reads from multiple independent channels at a virtual uniform rate, using the Interpolate trait for fractional-index interpolation.

§Type parameter

T must implement Transcendental for Linear / Cubic modes. Nearest mode only requires Copy.

Implementations§

Source§

impl<T: Transcendental + Copy> TimeSeriesReader<T>

Source

pub fn new() -> Self

Create an empty reader with nearest-neighbour interpolation.

Source

pub fn with_interp(self, mode: InterpMode) -> Self

Set the interpolation mode (builder pattern).

Source

pub fn set_interp(&mut self, mode: InterpMode)

Set the interpolation mode.

Source

pub fn interp_mode(&self) -> InterpMode

Return the current interpolation mode.

Source

pub fn add_channel(&mut self, channel: TimeSeriesChannel<T>)

Add a channel to the reader.

Source

pub fn num_channels(&self) -> usize

Number of registered channels.

Source

pub fn channel(&self, index: usize) -> Option<&TimeSeriesChannel<T>>

Immutable access to a channel by index.

Source

pub fn channel_mut(&mut self, index: usize) -> Option<&mut TimeSeriesChannel<T>>

Mutable access to a channel by index.

Source

pub fn duration(&self) -> f64

Total time span across all channels (union of ranges).

Source

pub fn at_time(&self, channel: usize, t: f64) -> T

Read value from a single channel at an arbitrary timestamp.

Source

pub fn read_block(&self, time: f64, sample_rate: f64, output: &mut [T])

Fill a planar output buffer.

Layout: [ch0_s0, ch0_s1, ..., ch0_s{BUF-1}, ch1_s0, ...] i.e. output[ch * buf_size + i].

Source

pub fn channels(&self) -> &[TimeSeriesChannel<T>]

All registered channels as a slice.

Trait Implementations§

Source§

impl<T: Transcendental + Copy> Default for TimeSeriesReader<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Freeze for TimeSeriesReader<T>

§

impl<T> RefUnwindSafe for TimeSeriesReader<T>
where T: RefUnwindSafe,

§

impl<T> Send for TimeSeriesReader<T>
where T: Send,

§

impl<T> Sync for TimeSeriesReader<T>
where T: Sync,

§

impl<T> Unpin for TimeSeriesReader<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for TimeSeriesReader<T>

§

impl<T> UnwindSafe for TimeSeriesReader<T>
where T: UnwindSafe,

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

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

Source§

fn vzip(self) -> V