This commit is contained in:
Dominik Werder
2024-10-25 16:31:37 +02:00
parent d773c42808
commit 52ae20ab02
12 changed files with 121 additions and 717 deletions
+34
View File
@@ -115,6 +115,39 @@ impl fmt::Display for MergeError {
impl std::error::Error for MergeError {}
pub trait IntoTimeBinnable: BoxedIntoTimeBinnable {
fn into_time_binnable(self) -> Box<dyn TimeBinnable>;
}
pub trait BoxedIntoTimeBinnable {
fn boxed_into_time_binnable(self: Box<Self>) -> Box<dyn TimeBinnable>;
}
impl<T> BoxedIntoTimeBinnable for T
where
T: IntoTimeBinnable,
{
fn boxed_into_time_binnable(self: Box<Self>) -> Box<dyn TimeBinnable> {
<Self as IntoTimeBinnable>::into_time_binnable(*self)
}
}
impl IntoTimeBinnable for Box<dyn IntoTimeBinnable + '_> {
fn into_time_binnable(self) -> Box<dyn TimeBinnable> {
<dyn IntoTimeBinnable as BoxedIntoTimeBinnable>::boxed_into_time_binnable(self)
}
}
impl IntoTimeBinnable for Box<dyn Events + '_> {
fn into_time_binnable(self) -> Box<dyn TimeBinnable> {
// <dyn IntoTimeBinnable as BoxedIntoTimeBinnable>::boxed_into_time_binnable(self)
// Box::new(*self)
// let a: Box<dyn Events> = err::todoval();
// let b: Box<dyn TimeBinnable> = Box::new(*a);
todo!()
}
}
// TODO can I remove the Any bound?
/// Container of some form of events, for use as trait object.
@@ -129,6 +162,7 @@ pub trait Events:
+ Send
+ erased_serde::Serialize
+ EventsNonObj
+ IntoTimeBinnable
{
fn as_time_binnable_ref(&self) -> &dyn TimeBinnable;
fn as_time_binnable_mut(&mut self) -> &mut dyn TimeBinnable;
-1
View File
@@ -113,7 +113,6 @@ pub trait BinningggContainerBinsDyn: fmt::Debug + Send + fmt::Display + WithLen
) -> std::iter::Zip<std::collections::vec_deque::Iter<TsNano>, std::collections::vec_deque::Iter<TsNano>>;
fn drain_into(&mut self, dst: &mut dyn BinningggContainerBinsDyn, range: Range<usize>);
fn fix_numerics(&mut self);
fn to_old_time_binned(&self) -> Box<dyn TimeBinned>;
}
pub type BinsBoxed = Box<dyn BinningggContainerBinsDyn>;