viirya commented on code in PR #3115:
URL: https://github.com/apache/arrow-rs/pull/3115#discussion_r1023553580
##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -92,6 +93,23 @@ impl MutableBuffer {
}
}
+ /// Allocates a new [MutableBuffer] from given `Bytes`.
+ pub(crate) fn from_bytes(bytes: Bytes, len: usize) -> Result<Self, Bytes> {
Review Comment:
That's due to different thoughts about the API. Previously I made the
builder starting from length 0. But for `unary_mut` I want to make a slice with
same length as the array before. So this is parameterized.
Now it is changed for your suggestion so this doesn't take a `len` parameter
now.
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -227,6 +227,25 @@ impl Buffer {
pub fn count_set_bits_offset(&self, offset: usize, len: usize) -> usize {
UnalignedBitChunk::new(self.as_slice(), offset, len).count_ones()
}
+
+ /// Returns `MutableBuffer` for mutating the buffer if this buffer is not
shared.
+ /// Returns `Err` if this is shared or its allocation is from an external
source.
+ pub fn into_mutable(self, len: usize) -> Result<MutableBuffer, Self> {
Review Comment:
Same as https://github.com/apache/arrow-rs/pull/3115#discussion_r1023553580
--
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]