parquet2/encoding/
mod.rs

1use std::convert::TryInto;
2
3pub mod bitpacked;
4pub mod delta_bitpacked;
5pub mod delta_byte_array;
6pub mod delta_length_byte_array;
7pub mod hybrid_rle;
8pub mod plain_byte_array;
9pub mod uleb128;
10pub mod zigzag_leb128;
11
12pub use crate::parquet_bridge::Encoding;
13
14/// # Panics
15/// This function panics iff `values.len() < 4`.
16#[inline]
17pub fn get_length(values: &[u8]) -> Option<usize> {
18    values
19        .get(0..4)
20        .map(|x| u32::from_le_bytes(x.try_into().unwrap()) as usize)
21}
22
23/// Returns the ceil of value / 8
24#[inline]
25pub fn ceil8(value: usize) -> usize {
26    value / 8 + ((value % 8 != 0) as usize)
27}