mbrobbel opened a new pull request, #5518:
URL: https://github.com/apache/arrow-rs/pull/5518
# Rationale for this change
This makes it easier to convert `ScalarBuffer`s to `Vec`s.
# What changes are included in this PR?
```rust
impl<T: ArrowNativeType> From<ScalarBuffer<T>> for Vec<T>
```
# Are there any user-facing changes?
Users can now convert a `ScalarBuffer<T>` directly to a `Vec<T>`, getting
zero-copy if possible, instead of having to do extra work when a copy can be
prevented:
```rust
// `Buffer::into_vec` + `Vec`s `From<&[T]>`:
let vec = scalar_buffer.into_inner().into_vec().unwrap_or_else(||
buffer.typed_data::<u8>().into());
// Because `Deref<Target=[T]>::to_vec` always makes a copy:
let vec = scalar_buffer.to_vec();
```
--
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]