Change byte estimate

This commit is contained in:
Dominik Werder
2025-03-07 11:41:44 +01:00
parent 1b19d4cab5
commit 7977c3c6b7
6 changed files with 34 additions and 23 deletions

View File

@@ -1,8 +1,8 @@
[package]
name = "daqbuf-items-0"
version = "0.0.3"
version = "0.0.4"
authors = ["Dominik Werder <dominik.werder@gmail.com>"]
edition = "2021"
edition = "2024"
[lib]
path = "src/lib.rs"
@@ -14,12 +14,9 @@ typetag = "0.2"
serde_json = "1"
ciborium = "0.2.1"
bincode = "1.3.3"
bytes = "1.8.0"
bytes = "1.10.0"
futures-util = "0.3.24"
thiserror = "=0.0.1"
autoerr = "0.0.3"
chrono = { version = "0.4.19", features = ["serde"] }
netpod = { path = "../daqbuf-netpod", package = "daqbuf-netpod" }
daqbuf-err = { path = "../daqbuf-err" }
[patch.crates-io]
thiserror = { git = "https://github.com/dominikwerder/thiserror.git", branch = "cstm" }

View File

@@ -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
}
}

1
src/event_value_type.rs Normal file
View File

@@ -0,0 +1 @@

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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
}
}