This is a starting point for a native Rust implementation of Arrow.
The current code demonstrates arrays of primitive types and structs.
// create a memory-aligned Arrow array from an existing Vec let array = Array::from(vec![1,2,3,4,5]); match array.data() { &ArrayData::Int32(ref buffer) => { println!("array contents: {:?}", buffer.iter().collect::<Vec<i32>>()); } _ => {} }
let mut builder: Builder<i32> = Builder::new(); for i in 0..10 { builder.push(i); } let buffer = builder.finish(); let array = Array::from(buffer);
Examples can be run using the cargo run --example
command. For example:
cargo run --example array_from_builder
cargo test