Skip to main content

Module offset

Module offset 

Source
Expand description

OffsetSizeTrait — the i32/i64 switch behind the Binary/ LargeBinary and Utf8/LargeUtf8 pairs, plus shared offset validation.

Arrow’s variable-length layouts differ only in the width of their offset buffer, so astrs-data writes each family once, generic over the offset type, and exposes the two instantiations as aliases. The Large variants exist because a 4 KiB × 1080p image column overflows i32 offsets after ~700 frames — a real limit for robotics payloads.

use astrs_data::array::{Array, BinaryArray, LargeBinaryArray, OffsetSizeTrait};

assert!(!<i32 as OffsetSizeTrait>::IS_LARGE);
assert!(<i64 as OffsetSizeTrait>::IS_LARGE);
assert_eq!(BinaryArray::from_opt_iter([Some(&b"x"[..])]).len(), 1);
assert_eq!(LargeBinaryArray::from_opt_iter([Some(&b"x"[..])]).len(), 1);

Traits§

OffsetSizeTrait
The offset width of a variable-length array: i32 or i64.

Functions§

validate_offsets
Validates an offset buffer against a value region.