Skip to content

Commit

Permalink
Add From<Bytes> for ByteArray (#3720)
Browse files Browse the repository at this point in the history
* Add From<Bytes> for ByteArray

* Format
  • Loading branch information
tustvold authored Feb 14, 2023
1 parent 86836a8 commit d740510
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions parquet/src/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

//! Data types that connect Parquet physical types with their Rust-specific
//! representations.
use bytes::Bytes;
use std::cmp::Ordering;
use std::fmt;
use std::mem;
Expand Down Expand Up @@ -214,6 +215,12 @@ impl From<ByteBufferPtr> for ByteArray {
}
}

impl From<Bytes> for ByteArray {
fn from(value: Bytes) -> Self {
ByteBufferPtr::from(value).into()
}
}

impl PartialEq for ByteArray {
fn eq(&self, other: &ByteArray) -> bool {
match (&self.data, &other.data) {
Expand Down

0 comments on commit d740510

Please sign in to comment.