[ 
https://issues.apache.org/jira/browse/ARROW-2408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16428812#comment-16428812
 ] 

ASF GitHub Bot commented on ARROW-2408:
---------------------------------------

andygrove commented on a change in pull request #1846: ARROW-2408: [Rust] 
Ability to get `&mut [T]` from `Buffer<T>`
URL: https://github.com/apache/arrow/pull/1846#discussion_r179852247
 
 

 ##########
 File path: rust/src/builder.rs
 ##########
 @@ -48,6 +47,18 @@ impl<T> Builder<T> {
         }
     }
 
+    /// Get the internal byte-aligned memory buffer as a mutable slice
+    pub fn slice_mut(&self, start: usize, end: usize) -> &mut [T] {
+        unsafe {
+            slice::from_raw_parts_mut(self.data.offset(start as isize), (end - 
start) as usize)
+        }
+    }
+
+    /// Override the length
+    pub fn set_len(&mut self, len: usize) {
 
 Review comment:
   Good point. I haven't been paying too much attention to safety guarantees at 
this point but I guess it is time to take care of that.
   
   I'll make those changes this weekend.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Rust] It should be possible to get a &mut[T] from Builder<T>
> -------------------------------------------------------------
>
>                 Key: ARROW-2408
>                 URL: https://issues.apache.org/jira/browse/ARROW-2408
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Rust
>            Reporter: Andy Grove
>            Assignee: Andy Grove
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.10.0
>
>
> I am currently adding Arrow support to the parquet-rs crate and I found a 
> need to get a mutable slice from a Buffer<T> to pass to the parquet column 
> reader methods.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to