mod file_reader;
mod file_writer;
mod tests_io;
pub use file_reader::FileReader;
pub use file_writer::FileWriter;
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum Offset {
I32(i32),
I64(i64),
}
impl std::convert::From<Offset> for i64 {
fn from(offset: Offset) -> Self {
match offset {
Offset::I32(value) => value as i64,
Offset::I64(value) => value,
}
}
}
pub(crate) const ABSENT_TAG: &[u8] = &[0; 8];
pub(crate) const DIMENSION_TAG: &[u8] = &[0, 0, 0, 0x0A];
pub(crate) const VARIABLE_TAG: &[u8] = &[0, 0, 0, 0x0b];
pub(crate) const ATTRIBUTE_TAG: &[u8] = &[0, 0, 0, 0x0C];
#[inline]
pub fn compute_padding_size(num_bytes: usize) -> usize {
const ALIGNMENT_SIZE: usize = 4;
match num_bytes % 4 {
0 => 0,
n => ALIGNMENT_SIZE - n,
}
}