pub struct TracesCollection {
pub max_points: usize,
pub points_bounds: (usize, usize),
pub max_age_secs: f64,
pub max_age_bounds: (f64, f64),
pub hover_trace: Option<Vec<TraceRef>>,
/* private fields */
}Expand description
Collection of all traces with their data.
Fields§
§max_points: usize§points_bounds: (usize, usize)§max_age_secs: f64Maximum age in seconds for retained points. 0.0 disables time-based pruning.
max_age_bounds: (f64, f64)Slider bounds for max_age_secs.
hover_trace: Option<Vec<TraceRef>>Implementations§
Source§impl TracesCollection
impl TracesCollection
pub fn new(rx: Receiver<PlotCommand>) -> Self
pub fn set_rx(&mut self, rx: Receiver<PlotCommand>)
Sourcepub fn set_pending_style(&mut self, name: &str, look: TraceLook, offset: f64)
pub fn set_pending_style(&mut self, name: &str, look: TraceLook, offset: f64)
Store a pending style for a trace that may not exist yet. When the trace is created from incoming data, this style will be applied instead of the default palette color.
pub fn update(&mut self) -> Vec<TraceRef>
pub fn take_snapshot(&mut self)
pub fn clear_snapshot(&mut self)
pub fn has_snapshot(&self) -> bool
pub fn clear_trace(&mut self, name: &TraceRef)
pub fn clear_all(&mut self)
pub fn remove_trace(&mut self, name: &TraceRef)
pub fn get_trace_or_new(&mut self, name: &TraceRef) -> &mut TraceData
pub fn get_points( &self, name: &TraceRef, snapshot: bool, ) -> Option<VecDeque<[f64; 2]>>
Sourcepub fn get_points_ref(
&self,
name: &TraceRef,
snapshot: bool,
) -> Option<&VecDeque<[f64; 2]>>
pub fn get_points_ref( &self, name: &TraceRef, snapshot: bool, ) -> Option<&VecDeque<[f64; 2]>>
Return a reference to the point buffer without cloning.
When snapshot is true, returns the snapshot buffer if available,
otherwise falls back to the live buffer.
Sourcepub fn get_drawn_points_decimated(
&self,
name: &TraceRef,
snapshot: bool,
bounds: (f64, f64),
max_pts: usize,
) -> Option<Vec<[f64; 2]>>
pub fn get_drawn_points_decimated( &self, name: &TraceRef, snapshot: bool, bounds: (f64, f64), max_pts: usize, ) -> Option<Vec<[f64; 2]>>
Return decimated points for a trace, filtering by x-bounds and
reducing to at most max_pts points. This avoids cloning the
full VecDeque — it iterates in-place and collects only the kept
points into a Vec.
pub fn get_all_points( &self, snapshot: bool, ) -> HashMap<TraceRef, VecDeque<[f64; 2]>>
pub fn traces_iter(&self) -> impl Iterator<Item = (&TraceRef, &TraceData)>
pub fn traces_iter_mut( &mut self, ) -> impl Iterator<Item = (&TraceRef, &mut TraceData)>
pub fn get_trace(&self, name: &TraceRef) -> Option<&TraceData>
pub fn get_trace_mut(&mut self, name: &TraceRef) -> Option<&mut TraceData>
pub fn contains_key(&self, name: &TraceRef) -> bool
pub fn keys(&self) -> impl Iterator<Item = &TraceRef>
pub fn all_trace_names(&self) -> Vec<TraceRef>
Sourcepub fn recolor_using_palette(&mut self)
pub fn recolor_using_palette(&mut self)
Update every trace’s colour to match the current global palette.
This is called when the colour scheme changes so that existing traces (created before the scheme was applied) are recoloured appropriately.
Sourcepub fn next_color_index(&self) -> usize
pub fn next_color_index(&self) -> usize
Find the first palette slot not currently used by any existing trace.
Returns the index to use for TraceLook::new(index) so that a newly
created trace gets a colour that doesn’t collide with any existing
trace. If all palette slots are in use, returns a sequential index
(based on the current trace count) so that consecutive new traces get
distinct colours that wrap around the palette, rather than all
collapsing to the same colour.
Sourcepub fn recolor_by_order(&mut self, order: &[TraceRef])
pub fn recolor_by_order(&mut self, order: &[TraceRef])
Recolour traces to match their position in order.
The Nth trace in order gets palette[N % palette.len()]. Traces
not present in order are left unchanged.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Sync for TracesCollection
impl Freeze for TracesCollection
impl RefUnwindSafe for TracesCollection
impl Send for TracesCollection
impl Unpin for TracesCollection
impl UnsafeUnpin for TracesCollection
impl UnwindSafe for TracesCollection
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().