diff --git a/items_0/src/collect_s.rs b/items_0/src/collect_s.rs
index 95969fb..abcaaf4 100644
--- a/items_0/src/collect_s.rs
+++ b/items_0/src/collect_s.rs
@@ -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;
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;
}
@@ -171,6 +171,13 @@ impl TypeName for Box {
}
}
+// TODO do this with some blanket impl:
+impl WithLen for Box {
+ fn len(&self) -> usize {
+ WithLen::len(self.as_ref())
+ }
+}
+
// TODO do this with some blanket impl:
impl Collectable for Box {
fn new_collector(&self) -> Box {
@@ -180,7 +187,7 @@ impl Collectable for Box {
impl WithLen for Box {
fn len(&self) -> usize {
- self.as_ref().len()
+ WithLen::len(self.as_ref())
}
}
diff --git a/items_0/src/items_0.rs b/items_0/src/items_0.rs
index 407321f..d835f81 100644
--- a/items_0/src/items_0.rs
+++ b/items_0/src/items_0.rs
@@ -141,3 +141,91 @@ impl PartialEq for Box {
Events::partial_eq_dyn(self.as_ref(), other.as_ref())
}
}
+
+impl EventsNonObj for Box {
+ fn into_tss_pulses(self: Box) -> (VecDeque, VecDeque) {
+ todo!()
+ }
+}
+
+impl Events for Box {
+ 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 {
+ todo!()
+ }
+
+ fn ts_max(&self) -> Option {
+ todo!()
+ }
+
+ fn take_new_events_until_ts(&mut self, ts_end: u64) -> Box {
+ todo!()
+ }
+
+ fn new_empty_evs(&self) -> Box {
+ todo!()
+ }
+
+ fn drain_into_evs(&mut self, dst: &mut Box, range: (usize, usize)) -> Result<(), MergeError> {
+ todo!()
+ }
+
+ fn find_lowest_index_gt_evs(&self, ts: u64) -> Option {
+ todo!()
+ }
+
+ fn find_lowest_index_ge_evs(&self, ts: u64) -> Option {
+ todo!()
+ }
+
+ fn find_highest_index_lt_evs(&self, ts: u64) -> Option {
+ todo!()
+ }
+
+ fn clone_dyn(&self) -> Box {
+ 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 {
+ todo!()
+ }
+
+ fn pulses(&self) -> &VecDeque {
+ todo!()
+ }
+}
diff --git a/items_0/src/timebin.rs b/items_0/src/timebin.rs
index c59e743..986bfac 100644
--- a/items_0/src/timebin.rs
+++ b/items_0/src/timebin.rs
@@ -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;
// 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 {
fn len(&self) -> usize {
- todo!()
+ WithLen::len(self.as_ref())
}
}
@@ -152,8 +155,8 @@ impl TypeName for Box {
}
impl Collectable for Box {
- fn new_collector(&self) -> Box {
- todo!()
+ fn new_collector(&self) -> Box {
+ self.as_ref().new_collector()
}
}
diff --git a/items_2/src/channelevents.rs b/items_2/src/channelevents.rs
index 430e91a..084e6c6 100644
--- a/items_2/src/channelevents.rs
+++ b/items_2/src/channelevents.rs
@@ -532,7 +532,7 @@ impl ByteEstimate for ChannelEvents {
impl Mergeable for ChannelEvents {
fn ts_min(&self) -> Option {
match self {
- ChannelEvents::Events(k) => k.ts_min(),
+ ChannelEvents::Events(k) => Mergeable::ts_min(k),
ChannelEvents::Status(k) => match k {
Some(k) => Some(k.ts),
None => None,
@@ -542,7 +542,7 @@ impl Mergeable for ChannelEvents {
fn ts_max(&self) -> Option {
match self {
- ChannelEvents::Events(k) => k.ts_max(),
+ ChannelEvents::Events(k) => Mergeable::ts_max(k),
ChannelEvents::Status(k) => match k {
Some(k) => Some(k.ts),
None => None,
diff --git a/items_2/src/streams.rs b/items_2/src/streams.rs
index 9864297..141c1b4 100644
--- a/items_2/src/streams.rs
+++ b/items_2/src/streams.rs
@@ -3,7 +3,9 @@ use futures_util::FutureExt;
use futures_util::Stream;
use futures_util::StreamExt;
use items_0::collect_s::Collectable;
+use items_0::streamitem::RangeCompletableItem;
use items_0::streamitem::Sitemty;
+use items_0::streamitem::StreamItem;
use items_0::transform::CollectableStreamTrait;
use items_0::transform::EventStreamTrait;
use items_0::transform::EventTransform;
@@ -249,9 +251,23 @@ where
{
type Item = Sitemty>;
- fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll