From cf310dba3df5fec730708efb4d0ad1f378a43b38 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 17 Jan 2025 10:16:13 +0000 Subject: [PATCH] Remove unused code in trace-to-events --- .../pulse_detection/datatype/eventpoint.rs | 10 ------- .../pulse_detection/datatype/tracepoint.rs | 5 ---- .../pulse_detection/datatype/tracevalue.rs | 27 ------------------- .../src/pulse_detection/detectors/mod.rs | 2 +- .../detectors/threshold_detector.rs | 23 +--------------- 5 files changed, 2 insertions(+), 65 deletions(-) diff --git a/trace-to-events/src/pulse_detection/datatype/eventpoint.rs b/trace-to-events/src/pulse_detection/datatype/eventpoint.rs index 3d8a9eca..c76faffc 100644 --- a/trace-to-events/src/pulse_detection/datatype/eventpoint.rs +++ b/trace-to-events/src/pulse_detection/datatype/eventpoint.rs @@ -7,8 +7,6 @@ pub(crate) trait EventPoint: Debug + Clone { fn get_time(&self) -> Self::TimeType; fn get_data(&self) -> &Self::EventType; - fn get_data_mut(&mut self) -> &mut Self::EventType; - fn take_data(self) -> Self::EventType; } impl EventPoint for (T, E) @@ -26,12 +24,4 @@ where fn get_data(&self) -> &E { &self.1 } - - fn get_data_mut(&mut self) -> &mut E { - &mut self.1 - } - - fn take_data(self) -> E { - self.1 - } } diff --git a/trace-to-events/src/pulse_detection/datatype/tracepoint.rs b/trace-to-events/src/pulse_detection/datatype/tracepoint.rs index 14c69fb4..b47fc2d8 100644 --- a/trace-to-events/src/pulse_detection/datatype/tracepoint.rs +++ b/trace-to-events/src/pulse_detection/datatype/tracepoint.rs @@ -20,7 +20,6 @@ pub(crate) trait TracePoint: Clone { fn get_time(&self) -> Self::TimeType; fn get_value(&self) -> &Self::ValueType; - fn take_value(self) -> Self::ValueType; fn clone_value(&self) -> Self::ValueType { self.get_value().clone() @@ -49,10 +48,6 @@ where &self.1 } - fn take_value(self) -> Self::ValueType { - self.1 - } - fn clone_value(&self) -> Self::ValueType { self.get_value().clone() } diff --git a/trace-to-events/src/pulse_detection/datatype/tracevalue.rs b/trace-to-events/src/pulse_detection/datatype/tracevalue.rs index 60a95232..bfb2b7dd 100644 --- a/trace-to-events/src/pulse_detection/datatype/tracevalue.rs +++ b/trace-to-events/src/pulse_detection/datatype/tracevalue.rs @@ -16,21 +16,10 @@ use std::{ /// - take_value(): destructs the data point and gives the caller ownership of the value. pub(crate) trait TraceValue: Default + Clone + Debug + Display { type ContentType: Default + Clone + Debug + Display; - - fn get_value(&self) -> &Self::ContentType; - fn take_value(self) -> Self::ContentType; } impl TraceValue for Real { type ContentType = Real; - - fn get_value(&self) -> &Self::ContentType { - self - } - - fn take_value(self) -> Self::ContentType { - self - } } /// This type allows the use of static arrays of TraceValue types as TraceValues @@ -93,14 +82,6 @@ where impl TraceValue for TraceArray { type ContentType = TraceArray; - - fn get_value(&self) -> &Self::ContentType { - self - } - - fn take_value(self) -> Self::ContentType { - self - } } /// In practice arrays of Real types are mostly used. @@ -132,12 +113,4 @@ impl Display for Stats { impl TraceValue for Stats { type ContentType = Stats; - - fn get_value(&self) -> &Self::ContentType { - self - } - - fn take_value(self) -> Self::ContentType { - self - } } diff --git a/trace-to-events/src/pulse_detection/detectors/mod.rs b/trace-to-events/src/pulse_detection/detectors/mod.rs index 1409f268..9f2ed581 100644 --- a/trace-to-events/src/pulse_detection/detectors/mod.rs +++ b/trace-to-events/src/pulse_detection/detectors/mod.rs @@ -2,7 +2,7 @@ pub mod advanced_muon_detector; pub mod threshold_detector; use super::{ - pulse::{TimeValue, TimeValueOptional}, + pulse::TimeValue, EventData, EventPoint, Pulse, Real, RealArray, TracePoint, }; diff --git a/trace-to-events/src/pulse_detection/detectors/threshold_detector.rs b/trace-to-events/src/pulse_detection/detectors/threshold_detector.rs index 9195afef..df80367e 100644 --- a/trace-to-events/src/pulse_detection/detectors/threshold_detector.rs +++ b/trace-to-events/src/pulse_detection/detectors/threshold_detector.rs @@ -1,4 +1,4 @@ -use super::{Assembler, Detector, EventData, Pulse, Real, TimeValueOptional}; +use super::{Detector, EventData, Real}; use std::fmt::Display; #[derive(Default, Debug, Clone, PartialEq)] @@ -118,27 +118,6 @@ impl Detector for ThresholdDetector { } } -#[derive(Default, Clone)] -pub(crate) struct ThresholdAssembler {} - -impl Assembler for ThresholdAssembler { - type DetectorType = ThresholdDetector; - - fn assemble_pulses( - &mut self, - source: ::EventPointType, - ) -> Option { - let (time, Data { pulse_height }) = source; - Some(Pulse { - start: TimeValueOptional { - time: Some(time), - value: Some(pulse_height), - }, - ..Default::default() - }) - } -} - #[cfg(test)] mod tests { use super::*;