[yew-devel] [PATCH yew-comp 07/20] rrd: remove unnecessary `no_data` field
Dominik Csapak
d.csapak at proxmox.com
Fri May 30 14:21:49 CEST 2025
just use slices, then we can return an empty slice here.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/rrd/graph.rs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/rrd/graph.rs b/src/rrd/graph.rs
index 8b31103..e1eb9c9 100644
--- a/src/rrd/graph.rs
+++ b/src/rrd/graph.rs
@@ -143,7 +143,6 @@ pub struct PwtRRDGraph {
datapoint_ref: NodeRef,
align_options: AlignOptions,
y_label_ref: NodeRef,
- no_data: Vec<f64>,
serie0_visible: bool,
serie1_visible: bool,
}
@@ -359,12 +358,12 @@ impl PwtRRDGraph {
let time_data = &props.time_data;
let serie0_data = match (self.serie0_visible, &props.serie0) {
- (true, Some(serie)) => &serie.data,
- _ => &self.no_data,
+ (true, Some(serie)) => &serie.data[..],
+ _ => &[],
};
let serie1_data = match (self.serie1_visible, &props.serie1) {
- (true, Some(serie)) => &serie.data,
- _ => &self.no_data,
+ (true, Some(serie)) => &serie.data[..],
+ _ => &[],
};
if let Some((start, end)) = self.view_range {
@@ -697,7 +696,6 @@ impl Component for PwtRRDGraph {
datapoint_ref: NodeRef::default(),
align_options,
y_label_ref: NodeRef::default(),
- no_data: Vec::new(),
serie0_visible: true,
serie1_visible: true,
}
--
2.39.5
More information about the yew-devel
mailing list