WIP
This commit is contained in:
@@ -135,12 +135,12 @@ where
|
||||
}
|
||||
|
||||
// TODO rename to `Typed`
|
||||
pub trait CollectableType: fmt::Debug + AsAnyRef + AsAnyMut + TypeName + Send {
|
||||
pub trait CollectableType: fmt::Debug + WithLen + AsAnyRef + AsAnyMut + TypeName + Send {
|
||||
type Collector: CollectorType<Input = Self>;
|
||||
fn new_collector() -> Self::Collector;
|
||||
}
|
||||
|
||||
pub trait Collectable: fmt::Debug + AsAnyRef + AsAnyMut + TypeName + Send {
|
||||
pub trait Collectable: fmt::Debug + WithLen + AsAnyRef + AsAnyMut + TypeName + Send {
|
||||
fn new_collector(&self) -> Box<dyn Collector>;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,13 @@ impl TypeName for Box<dyn Collectable> {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO do this with some blanket impl:
|
||||
impl WithLen for Box<dyn Collectable> {
|
||||
fn len(&self) -> usize {
|
||||
WithLen::len(self.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO do this with some blanket impl:
|
||||
impl Collectable for Box<dyn Collectable> {
|
||||
fn new_collector(&self) -> Box<dyn Collector> {
|
||||
@@ -180,7 +187,7 @@ impl Collectable for Box<dyn Collectable> {
|
||||
|
||||
impl WithLen for Box<dyn TimeBinned> {
|
||||
fn len(&self) -> usize {
|
||||
self.as_ref().len()
|
||||
WithLen::len(self.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,3 +141,91 @@ impl PartialEq for Box<dyn Events> {
|
||||
Events::partial_eq_dyn(self.as_ref(), other.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl EventsNonObj for Box<dyn Events> {
|
||||
fn into_tss_pulses(self: Box<Self>) -> (VecDeque<u64>, VecDeque<u64>) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Events for Box<dyn Events> {
|
||||
fn as_time_binnable_mut(&mut self) -> &mut dyn TimeBinnable {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn verify(&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn output_info(&self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn as_collectable_mut(&mut self) -> &mut dyn Collectable {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn as_collectable_with_default_ref(&self) -> &dyn Collectable {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn as_collectable_with_default_mut(&mut self) -> &mut dyn Collectable {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn ts_min(&self) -> Option<u64> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn ts_max(&self) -> Option<u64> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn take_new_events_until_ts(&mut self, ts_end: u64) -> Box<dyn Events> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn new_empty_evs(&self) -> Box<dyn Events> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn drain_into_evs(&mut self, dst: &mut Box<dyn Events>, range: (usize, usize)) -> Result<(), MergeError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn find_lowest_index_gt_evs(&self, ts: u64) -> Option<usize> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn find_lowest_index_ge_evs(&self, ts: u64) -> Option<usize> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn find_highest_index_lt_evs(&self, ts: u64) -> Option<usize> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn clone_dyn(&self) -> Box<dyn Events> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn partial_eq_dyn(&self, other: &dyn Events) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn serde_id(&self) -> &'static str {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn nty_id(&self) -> u32 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn tss(&self) -> &VecDeque<u64> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn pulses(&self) -> &VecDeque<u64> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::collect_s::Collectable;
|
||||
use crate::collect_s::Collector;
|
||||
use crate::collect_s::ToJsonResult;
|
||||
use crate::AsAnyMut;
|
||||
use crate::AsAnyRef;
|
||||
@@ -84,7 +85,9 @@ pub trait TimeBinner: fmt::Debug + Send {
|
||||
|
||||
/// Provides a time-binned representation of the implementing type.
|
||||
/// In contrast to `TimeBinnableType` this is meant for trait objects.
|
||||
pub trait TimeBinnable: fmt::Debug + WithLen + RangeOverlapInfo + Any + AsAnyRef + AsAnyMut + Send {
|
||||
pub trait TimeBinnable:
|
||||
fmt::Debug + WithLen + RangeOverlapInfo + Collectable + Any + AsAnyRef + AsAnyMut + Send
|
||||
{
|
||||
// TODO implementors may fail if edges contain not at least 2 entries.
|
||||
fn time_binner_new(&self, binrange: BinnedRangeEnum, do_time_weight: bool) -> Box<dyn TimeBinner>;
|
||||
// TODO just a helper for the empty result.
|
||||
@@ -93,7 +96,7 @@ pub trait TimeBinnable: fmt::Debug + WithLen + RangeOverlapInfo + Any + AsAnyRef
|
||||
|
||||
impl WithLen for Box<dyn TimeBinnable> {
|
||||
fn len(&self) -> usize {
|
||||
todo!()
|
||||
WithLen::len(self.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +155,8 @@ impl TypeName for Box<dyn TimeBinnable> {
|
||||
}
|
||||
|
||||
impl Collectable for Box<dyn TimeBinnable> {
|
||||
fn new_collector(&self) -> Box<dyn crate::collect_s::Collector> {
|
||||
todo!()
|
||||
fn new_collector(&self) -> Box<dyn Collector> {
|
||||
self.as_ref().new_collector()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user