Refactor for easier channel conversion tool

This commit is contained in:
Dominik Werder
2021-12-15 22:54:42 +01:00
parent 11229bd514
commit 7053af83b7
12 changed files with 1126 additions and 764 deletions
+8
View File
@@ -436,6 +436,7 @@ pub struct EventFull {
pub pulses: Vec<u64>,
pub blobs: Vec<Vec<u8>>,
#[serde(serialize_with = "decomps_ser", deserialize_with = "decomps_de")]
// TODO allow access to `decomps` via method which checks first if `blobs` is already the decomp.
pub decomps: Vec<Option<BytesMut>>,
pub scalar_types: Vec<ScalarType>,
pub be: Vec<bool>,
@@ -510,6 +511,13 @@ impl EventFull {
self.shapes.push(shape);
self.comps.push(comp);
}
pub fn decomp(&self, i: usize) -> &[u8] {
match &self.decomps[i] {
Some(decomp) => &decomp,
None => &self.blobs[i],
}
}
}
impl SitemtyFrameType for EventFull {