Skip to content

Apache DataFusion SQL Query Engine

ARROW-3035 [Rust] Examples in README.md do not run

Paddy Horan6685afd94f61
diff --git a/rust/README.md b/rust/README.md
index cb61efbd60..e3686fd3ce 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -32,14 +32,9 @@ The current code demonstrates arrays of primitive types and structs.
```rust
// create a memory-aligned Arrow array from an existing Vec
-let array = Array::from(vec![1,2,3,4,5]);
+let array = PrimitiveArray::from(vec![1, 2, 3, 4, 5]);
-match array.data() {
- &ArrayData::Int32(ref buffer) => {
- println!("array contents: {:?}", buffer.iter().collect::<Vec<i32>>());
- }
- _ => {}
-}
+println!("array contents: {:?}", array.iter().collect::<Vec<i32>>());
```
## Creating an Array from a Builder
@@ -50,7 +45,9 @@ for i in 0..10 {
builder.push(i);
}
let buffer = builder.finish();
-let array = Array::from(buffer);
+let array = PrimitiveArray::from(buffer);
+
+println!("array contents: {:?}", array.iter().collect::<Vec<i32>>());
```
## Run Examples