A Rust implementation of Apache Arrow.
The minimum supported Rust version is 1.54.
```rust use narrow::{Array, BooleanArray, Float32Array, StructArray, Uint8Array};
pub struct Person {
name: String,
age: u8,
happy: bool,
distance: Option
let persons = vec![ Person { name: "A".tostring(), age: 20, happy: true, distance: Some(1.5), }, Person { name: "B".tostring(), age: 22, happy: true, distance: None, }, ];
// Convert array of structs to struct of arrays.
let personsarray: StructArray
// To sum the ages we only need to read the age
array.
let agearray: &Uint8Array
// Make sure everyone is happy.
let happyarray: &BooleanArray
// The const generic bool in array types indicates nullability of the
// values in that array.
let distancearray: &Float32Array
// Convert struct of arrays back to array of structs
asserteq!(personsarray.into_iter().collect::
```rust use narrow::{Array, UnionArray};
pub enum Either {
This(bool),
That(Option
let input = vec![ Either::This(false), Either::This(true), Either::That(Some(1234)), Either::That(None), Either::This(true) ];
let array: UnionArray
asserteq!(array.len(), 5); asserteq!(array.child().This.len(), 3); asserteq!(array.child().That.len(), 2); asserteq!(array.child().That.null_count(), 1);
asserteq!(array.intoiter().collect::
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.