alamb commented on code in PR #11881:
URL: https://github.com/apache/arrow-rs/pull/11881#discussion_r4366706665


##########
arrow-ipc/src/reader.rs:
##########
@@ -72,6 +72,19 @@ fn read_buffer(
         }
     }
 }
+
+/// Like [`Buffer::slice_with_length`], but returns an error instead of 
panicking
+/// if the range is out of bounds
+fn slice_buffer(buffer: &Buffer, offset: usize, length: usize) -> 
Result<Buffer, ArrowError> {

Review Comment:
   how about adding this as a method to buffer? Perhaps follow the model of 
slice::get: https://doc.rust-lang.org/beta/std/primitive.slice.html#method.get
   
   Maybe `Buffer::try_slice_buffer()` or something that returns a Result
   
   This free function will jus get duplicated otherwise



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to