WIP typechecks

This commit is contained in:
Dominik Werder
2024-10-24 11:13:59 +02:00
parent 83842e04fc
commit e6ece07137
11 changed files with 243 additions and 44 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ pub trait CollectorType: fmt::Debug + Send + Unpin + WithLen + ByteEstimate {
fn result(&mut self, range: Option<SeriesRange>, binrange: Option<BinnedRangeEnum>) -> Result<Self::Output, Error>;
}
pub trait Collector: fmt::Debug + Send + Unpin + WithLen + ByteEstimate {
pub trait Collector: fmt::Debug + Send + WithLen + ByteEstimate {
fn ingest(&mut self, src: &mut dyn Collectable);
fn set_range_complete(&mut self);
fn set_timed_out(&mut self);
+15 -1
View File
@@ -103,7 +103,7 @@ pub trait BinningggContainerEventsDyn: fmt::Debug + Send {
fn to_anybox(&mut self) -> Box<dyn std::any::Any>;
}
pub trait BinningggContainerBinsDyn: fmt::Debug + Send + fmt::Display + WithLen + AsAnyMut {
pub trait BinningggContainerBinsDyn: fmt::Debug + Send + fmt::Display + WithLen + AsAnyMut + Collectable {
fn type_name(&self) -> &'static str;
fn empty(&self) -> BinsBoxed;
fn clone(&self) -> BinsBoxed;
@@ -196,6 +196,10 @@ impl TimeBinnable for Box<dyn TimeBinned> {
fn to_box_to_json_result(&self) -> Box<dyn ToJsonResult> {
self.as_ref().to_box_to_json_result()
}
fn to_container_bins(&self) -> Box<dyn BinningggContainerBinsDyn> {
self.as_ref().to_container_bins()
}
}
pub trait TimeBinner: fmt::Debug + Send {
@@ -237,6 +241,8 @@ pub trait TimeBinnable:
) -> Box<dyn TimeBinner>;
// TODO just a helper for the empty result.
fn to_box_to_json_result(&self) -> Box<dyn ToJsonResult>;
// TODO temporary converter
fn to_container_bins(&self) -> Box<dyn BinningggContainerBinsDyn>;
}
impl WithLen for Box<dyn TimeBinnable> {
@@ -273,6 +279,10 @@ impl TimeBinnable for Box<dyn TimeBinnable> {
fn to_box_to_json_result(&self) -> Box<dyn ToJsonResult> {
todo!()
}
fn to_container_bins(&self) -> Box<dyn BinningggContainerBinsDyn> {
self.as_ref().to_container_bins()
}
}
impl RangeOverlapInfo for Box<dyn Events> {
@@ -302,6 +312,10 @@ impl TimeBinnable for Box<dyn Events> {
fn to_box_to_json_result(&self) -> Box<dyn ToJsonResult> {
TimeBinnable::to_box_to_json_result(self.as_ref())
}
fn to_container_bins(&self) -> Box<dyn BinningggContainerBinsDyn> {
panic!("logic error this converter must not get used on events")
}
}
impl TypeName for Box<dyn TimeBinnable> {