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

Commit

Permalink
Added constructor new_from
Browse files Browse the repository at this point in the history
  • Loading branch information
hohav committed Jul 12, 2022
1 parent 91e1ef7 commit 1ff6a13
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/array/fixed_size_list/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ impl<M: MutableArray> MutableFixedSizeListArray<M> {
/// Creates a new [`MutableFixedSizeListArray`] from a [`MutableArray`] and size.
pub fn new(values: M, size: usize) -> Self {
let data_type = FixedSizeListArray::default_datatype(values.data_type().clone(), size);
assert_eq!(values.len(), 0);
Self {
size,
data_type,
values,
validity: None,
}
Self::new_from(values, data_type, size)
}

/// Creates a new [`MutableFixedSizeListArray`] from a [`MutableArray`] and size.
Expand All @@ -47,6 +41,11 @@ impl<M: MutableArray> MutableFixedSizeListArray<M> {
Box::new(Field::new(name, values.data_type().clone(), nullable)),
size,
);
Self::new_from(values, data_type, size)
}

/// Creates a new [`MutableFixedSizeListArray`] from a [`MutableArray`], [`DataType`] and size.
pub fn new_from(values: M, data_type: DataType, size: usize) -> Self {
assert_eq!(values.len(), 0);
Self {
size,
Expand Down

0 comments on commit 1ff6a13

Please sign in to comment.