Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
tighten invariants
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 13, 2021
1 parent 99a80b7 commit 493ddd4
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/array/binary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ impl<O: Offset> BinaryArray<O> {

/// Sets the validity bitmap on this [`BinaryArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ impl BooleanArray {

/// Sets the validity bitmap on this [`BooleanArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/dictionary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ impl<K: DictionaryKey> DictionaryArray<K> {

/// Sets the validity bitmap on this [`Array`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/fixed_size_binary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ impl FixedSizeBinaryArray {

/// Sets the validity bitmap on this [`FixedSizeBinaryArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/fixed_size_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ impl FixedSizeListArray {

/// Sets the validity bitmap on this [`FixedSizeListArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ impl<O: Offset> ListArray<O> {

/// Sets the validity bitmap on this [`ListArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ impl<T: NativeType> PrimitiveArray<T> {

/// Sets the validity bitmap on this [`PrimitiveArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/struct_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ impl StructArray {

/// Sets the validity bitmap on this [`StructArray`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/array/utf8/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ impl<O: Offset> Utf8Array<O> {

/// Sets the validity bitmap on this [`Utf8Array`].
/// # Panic
/// This function panics iff `validity.len() < self.len()`.
/// This function panics iff `validity.len() != self.len()`.
pub fn with_validity(&self, validity: Option<Bitmap>) -> Self {
if matches!(&validity, Some(bitmap) if bitmap.len() < self.len()) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
panic!("validity should be as least as large as the array")
}
let mut arr = self.clone();
Expand Down

0 comments on commit 493ddd4

Please sign in to comment.