Remove unused transform types
This commit is contained in:
@@ -80,7 +80,11 @@ pub trait CollectorTy: fmt::Debug + Send + Unpin + WithLen + ByteEstimate {
|
||||
fn set_continue_at_here(&mut self);
|
||||
|
||||
// TODO use this crate's Error instead:
|
||||
fn result(&mut self, range: Option<SeriesRange>, binrange: Option<BinnedRangeEnum>) -> Result<Self::Output, Error>;
|
||||
fn result(
|
||||
&mut self,
|
||||
range: Option<SeriesRange>,
|
||||
binrange: Option<BinnedRangeEnum>,
|
||||
) -> Result<Self::Output, Error>;
|
||||
}
|
||||
|
||||
pub trait CollectorDyn: fmt::Debug + Send + WithLen + ByteEstimate {
|
||||
@@ -105,7 +109,10 @@ where
|
||||
trace!("sees incoming &mut ref");
|
||||
T::ingest(self, src)
|
||||
} else {
|
||||
if let Some(src) = src.as_any_mut().downcast_mut::<Box<<T as CollectorTy>::Input>>() {
|
||||
if let Some(src) = src
|
||||
.as_any_mut()
|
||||
.downcast_mut::<Box<<T as CollectorTy>::Input>>()
|
||||
{
|
||||
trace!("sees incoming &mut Box");
|
||||
T::ingest(self, src)
|
||||
} else {
|
||||
@@ -148,49 +155,6 @@ pub trait CollectableType: fmt::Debug + WithLen + AsAnyRef + AsAnyMut + TypeName
|
||||
fn new_collector() -> Self::Collector;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CollectorForDyn {
|
||||
inner: Box<dyn CollectorDyn>,
|
||||
}
|
||||
|
||||
impl WithLen for CollectorForDyn {
|
||||
fn len(&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl ByteEstimate for CollectorForDyn {
|
||||
fn byte_estimate(&self) -> u64 {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CollectorDyn for CollectorForDyn {
|
||||
fn ingest(&mut self, src: &mut dyn CollectableDyn) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set_range_complete(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set_timed_out(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set_continue_at_here(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn result(
|
||||
&mut self,
|
||||
range: Option<SeriesRange>,
|
||||
binrange: Option<BinnedRangeEnum>,
|
||||
) -> Result<Box<dyn crate::collect_s::CollectedDyn>, Error> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CollectableDyn: fmt::Debug + WithLen + AsAnyRef + AsAnyMut + TypeName + Send {
|
||||
fn new_collector(&self) -> Box<dyn CollectorDyn>;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ use crate::container::ByteEstimate;
|
||||
use crate::subfr::SubFrId;
|
||||
use daqbuf_err as err;
|
||||
use netpod::EnumVariant;
|
||||
use netpod::StringFix;
|
||||
use serde::Serialize;
|
||||
use std::fmt;
|
||||
use std::ops;
|
||||
@@ -83,9 +82,6 @@ pub trait ScalarOps:
|
||||
fn equal_slack(&self, rhs: &Self) -> bool;
|
||||
fn add(&mut self, rhs: &Self);
|
||||
fn div(&mut self, n: usize);
|
||||
fn find_vec_min(a: &Vec<Self>) -> Option<Self>;
|
||||
fn find_vec_max(a: &Vec<Self>) -> Option<Self>;
|
||||
fn avg_vec(a: &Vec<Self>) -> Option<Self>;
|
||||
}
|
||||
|
||||
macro_rules! impl_scalar_ops {
|
||||
@@ -116,49 +112,6 @@ macro_rules! impl_scalar_ops {
|
||||
fn div(&mut self, n: usize) {
|
||||
$mac_div!(self, n);
|
||||
}
|
||||
|
||||
fn find_vec_min(a: &Vec<Self>) -> Option<Self> {
|
||||
if a.len() == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut k = &a[0];
|
||||
for (i, v) in a.iter().enumerate() {
|
||||
if *v < *k {
|
||||
k = &a[i];
|
||||
}
|
||||
}
|
||||
Some(k.clone())
|
||||
}
|
||||
}
|
||||
|
||||
fn find_vec_max(a: &Vec<Self>) -> Option<Self> {
|
||||
if a.len() == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut k = &a[0];
|
||||
for (i, v) in a.iter().enumerate() {
|
||||
if *v > *k {
|
||||
k = &a[i];
|
||||
}
|
||||
}
|
||||
Some(k.clone())
|
||||
}
|
||||
}
|
||||
|
||||
fn avg_vec(a: &Vec<Self>) -> Option<Self> {
|
||||
if a.len() == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut sum = Self::zero_b();
|
||||
let mut c = 0;
|
||||
for v in a.iter() {
|
||||
sum.add(v);
|
||||
c += 1;
|
||||
}
|
||||
ScalarOps::div(&mut sum, c);
|
||||
Some(sum)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -294,16 +247,4 @@ impl ScalarOps for EnumVariant {
|
||||
fn div(&mut self, _n: usize) {
|
||||
// undefined so far
|
||||
}
|
||||
|
||||
fn find_vec_min(a: &Vec<Self>) -> Option<Self> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn find_vec_max(a: &Vec<Self>) -> Option<Self> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn avg_vec(a: &Vec<Self>) -> Option<Self> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::collect_s::CollectableDyn;
|
||||
use crate::AsAnyMut;
|
||||
use crate::AsAnyRef;
|
||||
use crate::WithLen;
|
||||
use netpod::BinnedRange;
|
||||
use netpod::BinnedRangeEnum;
|
||||
@@ -79,19 +80,27 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub trait BinningggContainerEventsDyn: fmt::Debug + Send {
|
||||
pub trait BinningggContainerEventsDyn: fmt::Debug + Send + AsAnyRef {
|
||||
fn type_name(&self) -> &'static str;
|
||||
fn binned_events_timeweight_traitobj(&self, range: BinnedRange<TsNano>) -> Box<dyn BinnedEventsTimeweightTrait>;
|
||||
fn binned_events_timeweight_traitobj(
|
||||
&self,
|
||||
range: BinnedRange<TsNano>,
|
||||
) -> Box<dyn BinnedEventsTimeweightTrait>;
|
||||
fn to_anybox(&mut self) -> Box<dyn std::any::Any>;
|
||||
}
|
||||
|
||||
pub trait BinningggContainerBinsDyn: fmt::Debug + Send + fmt::Display + WithLen + AsAnyMut + CollectableDyn {
|
||||
pub trait BinningggContainerBinsDyn:
|
||||
fmt::Debug + Send + fmt::Display + WithLen + AsAnyMut + CollectableDyn
|
||||
{
|
||||
fn type_name(&self) -> &'static str;
|
||||
fn empty(&self) -> BinsBoxed;
|
||||
fn clone(&self) -> BinsBoxed;
|
||||
fn edges_iter(
|
||||
&self,
|
||||
) -> std::iter::Zip<std::collections::vec_deque::Iter<TsNano>, std::collections::vec_deque::Iter<TsNano>>;
|
||||
) -> 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);
|
||||
}
|
||||
@@ -122,7 +131,7 @@ pub trait BinningggBinnerDyn: fmt::Debug + Send {
|
||||
}
|
||||
|
||||
pub trait BinnedEventsTimeweightTrait: fmt::Debug + Send {
|
||||
fn ingest(&mut self, evs_all: EventsBoxed) -> Result<(), BinningggError>;
|
||||
fn ingest(&mut self, evs: &EventsBoxed) -> Result<(), BinningggError>;
|
||||
fn input_done_range_final(&mut self) -> Result<(), BinningggError>;
|
||||
fn input_done_range_open(&mut self) -> Result<(), BinningggError>;
|
||||
fn output(&mut self) -> Result<Option<BinsBoxed>, BinningggError>;
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
use crate::collect_s::CollectableDyn;
|
||||
use crate::collect_s::CollectedDyn;
|
||||
use crate::streamitem::RangeCompletableItem;
|
||||
use crate::streamitem::Sitemty;
|
||||
use crate::streamitem::StreamItem;
|
||||
use crate::Events;
|
||||
use daqbuf_err as err;
|
||||
use err::Error;
|
||||
use futures_util::stream;
|
||||
use futures_util::Future;
|
||||
use futures_util::Stream;
|
||||
use futures_util::StreamExt;
|
||||
use std::pin::Pin;
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
|
||||
pub trait EventStreamTrait: Stream<Item = Sitemty<Box<dyn Events>>> + WithTransformProperties + Send {}
|
||||
pub trait EventStreamTrait:
|
||||
Stream<Item = Sitemty<Box<dyn Events>>> + WithTransformProperties + Send
|
||||
{
|
||||
}
|
||||
|
||||
pub trait CollectableStreamTrait:
|
||||
Stream<Item = Sitemty<Box<dyn CollectableDyn>>> + WithTransformProperties + Send
|
||||
@@ -52,28 +51,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub trait EventTransform: WithTransformProperties + Send {
|
||||
fn transform(&mut self, src: Box<dyn Events>) -> Box<dyn Events>;
|
||||
}
|
||||
|
||||
impl<T> EventTransform for Box<T>
|
||||
where
|
||||
T: EventTransform,
|
||||
{
|
||||
fn transform(&mut self, src: Box<dyn Events>) -> Box<dyn Events> {
|
||||
self.as_mut().transform(src)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> EventTransform for Pin<Box<T>>
|
||||
where
|
||||
T: EventTransform,
|
||||
{
|
||||
fn transform(&mut self, src: Box<dyn Events>) -> Box<dyn Events> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IdentityTransform {}
|
||||
|
||||
impl IdentityTransform {
|
||||
@@ -88,26 +65,6 @@ impl WithTransformProperties for IdentityTransform {
|
||||
}
|
||||
}
|
||||
|
||||
impl EventTransform for IdentityTransform {
|
||||
fn transform(&mut self, src: Box<dyn Events>) -> Box<dyn Events> {
|
||||
src
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TransformEvent(pub Box<dyn EventTransform>);
|
||||
|
||||
impl WithTransformProperties for TransformEvent {
|
||||
fn query_transform_properties(&self) -> TransformProperties {
|
||||
self.0.query_transform_properties()
|
||||
}
|
||||
}
|
||||
|
||||
impl EventTransform for TransformEvent {
|
||||
fn transform(&mut self, src: Box<dyn Events>) -> Box<dyn Events> {
|
||||
self.0.transform(src)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> WithTransformProperties for stream::Iter<T> {
|
||||
fn query_transform_properties(&self) -> TransformProperties {
|
||||
todo!()
|
||||
@@ -126,7 +83,9 @@ where
|
||||
T: Events,
|
||||
{
|
||||
fn from(value: T) -> Self {
|
||||
let item = Ok(StreamItem::DataItem(RangeCompletableItem::Data(Box::new(value) as _)));
|
||||
let item = Ok(StreamItem::DataItem(RangeCompletableItem::Data(
|
||||
Box::new(value) as _,
|
||||
)));
|
||||
let x = stream::iter(vec![item]);
|
||||
Self(Box::pin(x))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user