pub struct Stream { /* private fields */ }Expand description
A rolling window of f64 samples with monotonically increasing x positions.
Each pushed sample gets x = x0 + n * dx where n counts every sample ever
pushed, so the x values keep increasing as old samples scroll out.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a stream keeping the last capacity samples (x step 1, start 0).
Sourcepub fn x_step(self, dx: f64) -> Self
pub fn x_step(self, dx: f64) -> Self
X distance between consecutive samples (non-positive / non-finite → 1).
Sourcepub fn push(&mut self, y: f64)
pub fn push(&mut self, y: f64)
Push a sample (non-finite values are stored as NaN and skipped by min/max).
Sourcepub fn points(&self) -> impl Iterator<Item = (f64, f64)> + '_
pub fn points(&self) -> impl Iterator<Item = (f64, f64)> + '_
Iterate (x, y) points, oldest first; x is strictly increasing.
Trait Implementations§
impl StructuralPartialEq for Stream
Auto Trait Implementations§
impl Forget for Stream
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnsafeUnpin for Stream
impl UnwindSafe for Stream
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more