Before refactor common item traits

This commit is contained in:
Dominik Werder
2022-11-29 14:37:22 +01:00
parent 75d492ff85
commit 075bdd05bd
10 changed files with 66 additions and 18 deletions

View File

@@ -325,6 +325,26 @@ pub trait TimeBinnable: fmt::Debug + WithLen + RangeOverlapInfo + Any + Send {
fn to_box_to_json_result(&self) -> Box<dyn ToJsonResult>;
}
// Helper trait to bridge between impls of event containers during refactoring.
// TODO get rid when no longer needed.
pub trait IntoEvents {
fn into_events(self) -> Box<dyn Events>;
}
impl<NTY> IntoEvents for items::scalarevents::ScalarEvents<NTY>
where
NTY: ScalarOps,
{
fn into_events(self) -> Box<dyn Events> {
let ret = items_2::eventsdim0::EventsDim0::<NTY> {
tss: self.tss.into(),
pulses: self.pulses.into(),
values: self.values.into(),
};
Box::new(ret)
}
}
// TODO can I remove the Any bound?
/// Container of some form of events, for use as trait object.