Change byte estimate
This commit is contained in:
+15
-1
@@ -1,3 +1,17 @@
|
||||
use netpod::UnsupEvt;
|
||||
|
||||
pub trait ByteEstimate {
|
||||
fn byte_estimate(&self) -> u64;
|
||||
fn byte_estimate(&self) -> u32;
|
||||
}
|
||||
|
||||
impl ByteEstimate for UnsupEvt {
|
||||
fn byte_estimate(&self) -> u32 {
|
||||
200
|
||||
}
|
||||
}
|
||||
|
||||
impl ByteEstimate for Vec<UnsupEvt> {
|
||||
fn byte_estimate(&self) -> u32 {
|
||||
200
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
pub mod apitypes;
|
||||
pub mod collect_s;
|
||||
pub mod container;
|
||||
pub mod event_value_type;
|
||||
pub mod events;
|
||||
pub mod framable;
|
||||
pub mod isodate;
|
||||
|
||||
+10
-8
@@ -1,16 +1,18 @@
|
||||
use crate::container::ByteEstimate;
|
||||
use crate::timebin::BinningggContainerEventsDyn;
|
||||
use crate::AsAnyMut;
|
||||
use crate::WithLen;
|
||||
use core::ops::Range;
|
||||
use netpod::TsMs;
|
||||
use crate::container::ByteEstimate;
|
||||
use crate::timebin::BinningggContainerEventsDyn;
|
||||
use netpod::TsNano;
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
use std::ops::Range;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[cstm(name = "MergeError")]
|
||||
pub enum Error {}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "MergeError"),
|
||||
enum variants {
|
||||
Logic,
|
||||
},
|
||||
);
|
||||
|
||||
impl From<Error> for daqbuf_err::Error {
|
||||
fn from(e: Error) -> Self {
|
||||
@@ -59,7 +61,7 @@ pub trait MergeableDyn: fmt::Debug + WithLen + ByteEstimate + Unpin + AsAnyMut {
|
||||
fn find_highest_index_lt(&self, ts: TsNano) -> Option<usize>;
|
||||
fn tss_for_testing(&self) -> VecDeque<TsNano>;
|
||||
fn drain_into(&mut self, dst: &mut dyn MergeableDyn, range: Range<usize>)
|
||||
-> DrainIntoDstResult;
|
||||
-> DrainIntoDstResult;
|
||||
fn drain_into_new(&mut self, range: Range<usize>) -> DrainIntoNewDynResult;
|
||||
fn is_consistent(&self) -> bool;
|
||||
}
|
||||
|
||||
+3
-7
@@ -48,11 +48,7 @@ impl_as_prim_f32!(f64);
|
||||
|
||||
impl AsPrimF32 for bool {
|
||||
fn as_prim_f32_b(&self) -> f32 {
|
||||
if *self {
|
||||
1.
|
||||
} else {
|
||||
0.
|
||||
}
|
||||
if *self { 1. } else { 0. }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +83,7 @@ pub trait ScalarOps:
|
||||
macro_rules! impl_scalar_ops {
|
||||
($ty:ident, $zero:expr, $equal_slack:ident, $mac_add:ident, $mac_div:ident, $sty_name:expr, $byte_estimate:expr) => {
|
||||
impl ByteEstimate for $ty {
|
||||
fn byte_estimate(&self) -> u64 {
|
||||
fn byte_estimate(&self) -> u32 {
|
||||
$byte_estimate
|
||||
}
|
||||
}
|
||||
@@ -216,7 +212,7 @@ impl_scalar_ops!(
|
||||
);
|
||||
|
||||
impl ByteEstimate for EnumVariant {
|
||||
fn byte_estimate(&self) -> u64 {
|
||||
fn byte_estimate(&self) -> u32 {
|
||||
12
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user