Reduce db connections, improve merge mt/lt
This commit is contained in:
@@ -859,9 +859,9 @@ impl<STY: ScalarOps> Events for EventsDim0<STY> {
|
||||
Box::new(Self::empty())
|
||||
}
|
||||
|
||||
fn drain_into_evs(&mut self, dst: &mut Box<dyn Events>, range: (usize, usize)) -> Result<(), MergeError> {
|
||||
fn drain_into_evs(&mut self, dst: &mut dyn Events, range: (usize, usize)) -> Result<(), MergeError> {
|
||||
// TODO as_any and as_any_mut are declared on unrelated traits. Simplify.
|
||||
if let Some(dst) = dst.as_mut().as_any_mut().downcast_mut::<Self>() {
|
||||
if let Some(dst) = dst.as_any_mut().downcast_mut::<Self>() {
|
||||
// TODO make it harder to forget new members when the struct may get modified in the future
|
||||
let r = range.0..range.1;
|
||||
dst.tss.extend(self.tss.drain(r.clone()));
|
||||
@@ -869,7 +869,12 @@ impl<STY: ScalarOps> Events for EventsDim0<STY> {
|
||||
dst.values.extend(self.values.drain(r.clone()));
|
||||
Ok(())
|
||||
} else {
|
||||
error!("downcast to EventsDim0 FAILED");
|
||||
error!(
|
||||
"downcast to EventsDim0 FAILED\n\n{}\n\n{}\n\n",
|
||||
self.type_name(),
|
||||
dst.type_name()
|
||||
);
|
||||
panic!();
|
||||
Err(MergeError::NotCompatible)
|
||||
}
|
||||
}
|
||||
@@ -989,6 +994,12 @@ impl<STY: ScalarOps> Events for EventsDim0<STY> {
|
||||
ciborium::into_writer(&ret, &mut buf).unwrap();
|
||||
buf
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.tss.clear();
|
||||
self.pulses.clear();
|
||||
self.values.clear();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user