pub struct SampleTable { /* private fields */ }Expand description
A table of sample values, with timestamps indexing rows and channels indexing columns. Values are stored in column-major order.
Implementations§
Source§impl SampleTable
impl SampleTable
Sourcepub fn new(
timestamps: Vec<u64>,
channels: Vec<ChannelStreamDescriptor>,
values: Vec<ValueSeries>,
) -> Result<Self, SampleTableError>
pub fn new( timestamps: Vec<u64>, channels: Vec<ChannelStreamDescriptor>, values: Vec<ValueSeries>, ) -> Result<Self, SampleTableError>
Create a sample table from a list of timestamps, channels, and value series.
Each ValueSeries corresponds to the index-matched channel in channels,
and must have the same length as timestamps.
Sourcepub fn from_single_channel(
timestamp: u64,
channel: ChannelStreamDescriptor,
value: Value,
) -> Self
pub fn from_single_channel( timestamp: u64, channel: ChannelStreamDescriptor, value: Value, ) -> Self
Create a sample table with a single timestamp and single values for a single channel.
Sourcepub fn from_multiple_channels(
timestamp: u64,
channels: Vec<ChannelStreamDescriptor>,
values: Vec<Value>,
) -> Result<Self, SampleTableError>
pub fn from_multiple_channels( timestamp: u64, channels: Vec<ChannelStreamDescriptor>, values: Vec<Value>, ) -> Result<Self, SampleTableError>
Create a sample table with a single timestamp and single values for multiple channels.
Sourcepub fn iter_rows<'values>(
&'values self,
) -> Result<impl Iterator<Item = RowRef<'values>>, SampleTableError>
pub fn iter_rows<'values>( &'values self, ) -> Result<impl Iterator<Item = RowRef<'values>>, SampleTableError>
Lazily-evaluated iterator over the rows of the sample table.
Sourcepub fn channels(&self) -> &[ChannelStreamDescriptor]
pub fn channels(&self) -> &[ChannelStreamDescriptor]
The channels in the sample table.
Sourcepub fn timestamps(&self) -> &[u64]
pub fn timestamps(&self) -> &[u64]
The timestamps in the sample table.
Sourcepub fn columns(&self) -> &[ValueSeries]
pub fn columns(&self) -> &[ValueSeries]
The columns in the sample table.
Sourcepub fn get_channel_values(
&self,
channel: &ChannelStreamDescriptor,
) -> Option<&ValueSeries>
pub fn get_channel_values( &self, channel: &ChannelStreamDescriptor, ) -> Option<&ValueSeries>
The values for a given channel.
Sourcepub fn get_timestamped_channel_values(
&self,
channel: &ChannelStreamDescriptor,
) -> Option<impl Iterator<Item = (u64, ValueRef<'_>)>>
pub fn get_timestamped_channel_values( &self, channel: &ChannelStreamDescriptor, ) -> Option<impl Iterator<Item = (u64, ValueRef<'_>)>>
The values for a given channel and timestamp.
Sourcepub fn num_points(&self) -> usize
pub fn num_points(&self) -> usize
The number of points in the stream.
Sourcepub fn scale_channel(
&mut self,
channel: &ChannelStreamDescriptor,
f: impl FnMut(ValueRef<'_>) -> Result<f64, String>,
) -> Result<(), SampleTableError>
pub fn scale_channel( &mut self, channel: &ChannelStreamDescriptor, f: impl FnMut(ValueRef<'_>) -> Result<f64, String>, ) -> Result<(), SampleTableError>
Apply a scaling function to a channel’s values in place.
An error is returned if the channel specified is not present.
If any individual scaling operation fails, no further values are computed and the error is returned.
Trait Implementations§
Source§impl Clone for SampleTable
impl Clone for SampleTable
Source§fn clone(&self) -> SampleTable
fn clone(&self) -> SampleTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more