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

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

crepererum 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_r179813579
 
 

 ##########
 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:
   So this function should semantically be marked as `unsafe`, since the user 
could set this to whatever value (even higher then the actual capacity).

----------------------------------------------------------------
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