pub struct TimeSeries<T> { /* private fields */ }Expand description
The common module records and containers. These explicit facade exports keep ordinary callers out of the component crate paths. Ordered complete values of one Rust type.
Implementations§
Source§impl<T> TimeSeries<T>
impl<T> TimeSeries<T>
pub fn new( time_points: Vec<TimePoint>, values: Vec<T>, ) -> Result<TimeSeries<T>, Error>
pub fn time_points(&self) -> &[TimePoint]
pub fn values(&self) -> &[T]
pub fn get(&self, index: usize) -> Option<&T>
Sourcepub fn entry(&self, index: usize) -> Option<(&TimePoint, &T)>
pub fn entry(&self, index: usize) -> Option<(&TimePoint, &T)>
Look up one complete entry when its time metadata is also needed.
pub fn time_point(&self, index: usize) -> Option<&TimePoint>
pub fn iter(&self) -> impl ExactSizeIterator
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl<T> TimeSeries<T>where
T: Clone,
impl<T> TimeSeries<T>where
T: Clone,
Sourcepub fn values_mut(&mut self) -> &mut [T]
pub fn values_mut(&mut self) -> &mut [T]
Mutably borrow all values through copy on write. Time metadata remains shared because editing a value never changes its position.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Mutably borrow one value through copy on write.
Sourcepub fn entry_mut(&mut self, index: usize) -> Option<(&TimePoint, &mut T)>
pub fn entry_mut(&mut self, index: usize) -> Option<(&TimePoint, &mut T)>
Mutably borrow one value together with its immutable time metadata.
Sourcepub fn iter_mut(&mut self) -> impl ExactSizeIterator
pub fn iter_mut(&mut self) -> impl ExactSizeIterator
Iterate over mutable values and immutable time metadata through one copy on write detachment.
Sourcepub fn map_values<U>(self, map: impl FnMut(T) -> U) -> TimeSeries<U>
pub fn map_values<U>(self, map: impl FnMut(T) -> U) -> TimeSeries<U>
Consume the series and map each complete value while retaining the
time axis. A uniquely owned series moves its values into map without
cloning them; a shared series first performs the copy on write split.
Trait Implementations§
Source§impl<T> Clone for TimeSeries<T>
impl<T> Clone for TimeSeries<T>
Source§fn clone(&self) -> TimeSeries<T>
fn clone(&self) -> TimeSeries<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more