WIP Refactor stream build up, it type checks

This commit is contained in:
Dominik Werder
2021-06-04 17:57:40 +02:00
parent b07fa84b42
commit e4c5e05310
11 changed files with 622 additions and 48 deletions

View File

@@ -251,6 +251,46 @@ impl NanoRange {
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum ByteOrder {
LE,
BE,
}
impl ByteOrder {
pub fn little_endian() -> Self {
Self::LE
}
pub fn big_endian() -> Self {
Self::BE
}
pub fn from_dtype_flags(flags: u8) -> Self {
if flags & 0x20 == 0 {
Self::LE
} else {
Self::BE
}
}
pub fn is_le(&self) -> bool {
if let Self::LE = self {
true
} else {
false
}
}
pub fn is_be(&self) -> bool {
if let Self::BE = self {
true
} else {
false
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ChannelConfig {
pub channel: Channel,
@@ -260,7 +300,7 @@ pub struct ChannelConfig {
pub compression: bool,
pub shape: Shape,
pub array: bool,
pub big_endian: bool,
pub byte_order: ByteOrder,
}
#[derive(Clone, Debug, Serialize, Deserialize)]