diff --git a/arrow/src/array/array_primitive.rs b/arrow/src/array/array_primitive.rs index 9c14f88d487a..5777a0304844 100644 --- a/arrow/src/array/array_primitive.rs +++ b/arrow/src/array/array_primitive.rs @@ -44,6 +44,19 @@ const MICROSECONDS: i64 = 1_000_000; const NANOSECONDS: i64 = 1_000_000_000; /// Array whose elements are of primitive types. +/// +/// # Example: From an iterator of values +/// +/// ``` +/// use arrow::array::{Array, PrimitiveArray}; +/// use arrow::datatypes::Int32Type; +/// let arr: PrimitiveArray = PrimitiveArray::from_iter_values((0..10).map(|x| x + 1)); +/// assert_eq!(10, arr.len()); +/// assert_eq!(0, arr.null_count()); +/// for i in 0..10i32 { +/// assert_eq!(i + 1, arr.value(i as usize)); +/// } +/// ``` pub struct PrimitiveArray { /// Underlying ArrayData /// # Safety