You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2018/08/15 11:00:31 UTC

[arrow] branch master updated: ARROW-3035 [Rust] Examples in README.md do not run

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c42737  ARROW-3035 [Rust] Examples in README.md do not run
8c42737 is described below

commit 8c42737e61ca43b3d539e8e25c45db3da96da969
Author: Paddy Horan <pa...@hotmail.com>
AuthorDate: Wed Aug 15 13:00:07 2018 +0200

    ARROW-3035 [Rust] Examples in README.md do not run
    
    Author: Paddy Horan <pa...@hotmail.com>
    
    Closes #2418 from paddyhoran/Issue-3035 and squashes the following commits:
    
    cbe4b17 <Paddy Horan> Fixed typo
    7a7b64c <Paddy Horan> Fixed issues with Rust examples
---
 rust/README.md | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/rust/README.md b/rust/README.md
index cb61efb..e3686fd 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