WIP
This commit is contained in:
@@ -407,8 +407,6 @@ where
|
||||
{
|
||||
// TODO push bin to output.
|
||||
let res = b.agg.result_and_reset_for_new_bin();
|
||||
let cnt = b.cnt;
|
||||
b.cnt = 0;
|
||||
self.out.push_back(
|
||||
b.active_beg,
|
||||
b.active_end,
|
||||
@@ -426,6 +424,7 @@ where
|
||||
b.active_beg = ts1;
|
||||
b.active_end = ts1.add_dt_nano(b.active_len);
|
||||
b.filled_until = ts1;
|
||||
b.cnt = 0;
|
||||
self.inner_a.minmax = Some((lst.clone(), lst.clone()));
|
||||
} else {
|
||||
self.inner_a.inner_b.fill_until(ts, LstRef(lst));
|
||||
|
||||
@@ -3,6 +3,7 @@ use super::binnedvaluetype::BinnedNumericValue;
|
||||
use super::container_events::Container;
|
||||
use super::container_events::EventValueType;
|
||||
use crate::vecpreview::PreviewRange;
|
||||
use core::fmt;
|
||||
use netpod::DtNano;
|
||||
use netpod::EnumVariant;
|
||||
use serde::Deserialize;
|
||||
@@ -16,8 +17,12 @@ pub struct EnumVariantContainer {
|
||||
}
|
||||
|
||||
impl PreviewRange for EnumVariantContainer {
|
||||
fn preview(&self) -> &dyn core::fmt::Debug {
|
||||
todo!()
|
||||
fn preview<'a>(&'a self) -> Box<dyn fmt::Debug + 'a> {
|
||||
let ret = crate::vecpreview::PreviewCell {
|
||||
a: self.ixs.front(),
|
||||
b: self.ixs.back(),
|
||||
};
|
||||
Box::new(ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
use core::fmt;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub trait PreviewRange {
|
||||
fn preview(&self) -> &dyn fmt::Debug;
|
||||
pub struct PreviewCell<'a, T> {
|
||||
pub a: Option<&'a T>,
|
||||
pub b: Option<&'a T>,
|
||||
}
|
||||
|
||||
impl<T> PreviewRange for VecDeque<T> {
|
||||
fn preview(&self) -> &dyn fmt::Debug {
|
||||
todo!()
|
||||
impl<'a, T> fmt::Debug for PreviewCell<'a, T>
|
||||
where
|
||||
T: fmt::Debug,
|
||||
{
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
match (self.a.as_ref(), self.b.as_ref()) {
|
||||
(Some(a), Some(b)) => write!(fmt, "{:?} .. {:?}", a, b),
|
||||
(Some(a), None) => write!(fmt, "{:?}", a),
|
||||
_ => write!(fmt, "(empty)"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait PreviewRange {
|
||||
fn preview<'a>(&'a self) -> Box<dyn fmt::Debug + 'a>;
|
||||
}
|
||||
|
||||
impl<T> PreviewRange for VecDeque<T>
|
||||
where
|
||||
T: fmt::Debug,
|
||||
{
|
||||
fn preview<'a>(&'a self) -> Box<dyn fmt::Debug + 'a> {
|
||||
let ret = PreviewCell {
|
||||
a: self.front(),
|
||||
b: if self.len() <= 1 { None } else { self.back() },
|
||||
};
|
||||
Box::new(ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user