pub struct TimeSeries<T> { /* private fields */ }Expand description
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<Self, 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<Item = (&TimePoint, &T)>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl<T: Clone> TimeSeries<T>
impl<T: Clone> TimeSeries<T>
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<Item = (&TimePoint, &mut T)>
pub fn iter_mut( &mut self, ) -> impl ExactSizeIterator<Item = (&TimePoint, &mut T)>
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>
Auto Trait Implementations§
impl<T> Freeze for TimeSeries<T>
impl<T> RefUnwindSafe for TimeSeries<T>where
T: RefUnwindSafe,
impl<T> Send for TimeSeries<T>
impl<T> Sync for TimeSeries<T>
impl<T> Unpin for TimeSeries<T>
impl<T> UnsafeUnpin for TimeSeries<T>
impl<T> UnwindSafe for TimeSeries<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more