#[macro_export]
macro_rules! impl_numeric_array_constructors {
($array:ident, $bound:ident) => {
impl<T> $array<T>
where
T: $bound,
{
#[inline]
pub fn new(data: impl Into<Buffer<T>>, null_mask: Option<Bitmask>) -> Self {
let data: Buffer<T> = data.into();
crate::utils::validate_null_mask_len(data.len(), &null_mask);
Self { data, null_mask }
}
#[inline]
pub fn with_capacity(cap: usize, null_mask: bool) -> Self {
Self {
data: Vec64::with_capacity(cap).into(),
null_mask: if null_mask {
Some($crate::structs::bitmask::Bitmask::with_capacity(cap))
} else {
None
},
}
}
#[inline]
pub fn from_slice(slice: &[T]) -> Self {
Self {
data: Vec64(slice.to_vec_in(::vec64::Vec64Alloc::default())).into(),
null_mask: None,
}
}
}
};
}
#[macro_export]
macro_rules! impl_masked_array {
($array:ident, $bound:ident, $container:ty, $logicaltype:ty $(, $extra_field:ident)?) => {
impl<T> crate::traits::masked_array::MaskedArray for $array<T>
where
T: crate::traits::type_unions::$bound
{
type T = T;
type Container = $container;
type LogicalType = $logicaltype;
type CopyType = $logicaltype;
fn data(&self) -> &Buffer<T> {
&self.data
}
#[inline]
fn push(&mut self, value: T) {
self.data_mut().push(value);
let idx = self.len() - 1;
if let Some(nm) = &mut self.null_mask {
nm.set(idx, true);
}
}
#[inline(always)]
unsafe fn push_unchecked(&mut self, value: T) {
let idx = self.len();
unsafe {
self.set_unchecked(idx, value);
if let Some(mask) = self.null_mask_mut() {
mask.set_unchecked(idx, true);
}
}
}
#[inline]
fn len(&self) -> usize {
self.data.len()
}
fn null_mask(&self) -> Option<&$crate::structs::bitmask::Bitmask> {
self.null_mask.as_ref()
}
fn slice_clone(&self, offset: usize, len: usize) -> Self {
assert!(offset + len <= self.data.len(), "slice out of bounds");
let data = crate::Vec64::from_slice(&self.data[offset..offset + len]);
let null_mask = self.null_mask.as_ref().map(|m| m.slice_clone(offset, len));
Self { data: data.into(),
null_mask,
$(
$extra_field: self.$extra_field.clone(),
)?
..Default::default() }
}
#[doc = "Converts a [`"]
#[doc = stringify!($array)]
#[doc = "<T>`] window. Like a slice, but retains access to the original "]
#[doc = stringify!($array)]
#[doc = ". Generally, prefer `as_slice` for `Float`, `Integer`,
usually for `DateTime` array types, as it natively slices window boundaries.
See **crate::structs::window** for further details."]
#[inline(always)]
fn tuple_ref<'a>(
&'a self,
offset: Offset,
len: Length,
) -> (&'a Self, Offset, Length) {
(&self, offset, len)
}
fn null_mask_mut(&mut self) -> Option<&mut $crate::structs::bitmask::Bitmask> {
self.null_mask.as_mut()
}
fn set_null_mask(&mut self, mask: Option<$crate::structs::bitmask::Bitmask>) {
self.null_mask = mask;
}
fn data_mut(&mut self) -> &mut $crate::structs::buffer::Buffer<T> {
&mut self.data
}
#[inline]
fn iter(&self) -> impl Iterator<Item = T> + '_
where
T: Copy
{
(0..self.len()).map(move |i| self.data()[i])
}
#[inline]
fn iter_opt(&self) -> impl Iterator<Item = Option<T>> + '_
where
T: Copy
{
(0..self.len()).map(
move |i| {
if self.is_null(i) { None } else { Some(self.data()[i]) }
}
)
}
#[inline]
fn iter_range(&self, offset: usize, len: usize) -> impl Iterator<Item = T> + '_
where
T: Copy,
{
(offset..offset + len).map(move |i| self.data()[i])
}
#[inline]
fn iter_opt_range(&self, offset: usize, len: usize) -> impl Iterator<Item = Option<T>> + '_
where
T: Copy,
{
(offset..offset + len).map(move |i| {
if self.is_null(i) {
None
} else {
Some(self.data()[i])
}
})
}
#[inline]
fn get(&self, idx: usize) -> Option<T> {
if idx >= self.len() {
return None;
}
if self.is_null(idx) { None } else { self.data().get(idx).copied() }
}
#[inline(always)]
unsafe fn get_unchecked(&self, idx: usize) -> Option<T> {
if let Some(mask) = self.null_mask() {
if !mask.get(idx) {
return None;
}
}
Some(unsafe { *self.data().get_unchecked(idx) })
}
#[inline]
fn set(&mut self, idx: usize, value: T) {
assert!(idx < self.len(), "index out of bounds");
let data = self.data_mut().as_mut_slice();
data[idx] = value;
if let Some(mask) = self.null_mask_mut() {
mask.set(idx, true);
}
}
#[inline(always)]
unsafe fn set_unchecked(&mut self, idx: usize, value: T) {
let data = self.data_mut().as_mut_slice();
data[idx] = value;
if let Some(mask) = self.null_mask_mut() {
unsafe { mask.set_unchecked(idx, true) };
}
}
fn resize(&mut self, n: usize, value: T) {
self.data.resize(n, value)
}
fn append_array(&mut self, other: &Self) {
let orig_len = self.len();
let other_len = other.len();
if other_len == 0 {
return;
}
self.data_mut().extend_from_slice(other.data());
match (self.null_mask_mut(), other.null_mask()) {
(Some(self_mask), Some(other_mask)) => {
self_mask.extend_from_bitmask(other_mask);
}
(Some(self_mask), None) => {
for i in orig_len..(orig_len + other_len) {
self_mask.set(i, true);
}
}
(None, Some(other_mask)) => {
let mut mask = Bitmask::new_set_all(orig_len + other_len, true);
for i in 0..other_len {
mask.set(orig_len + i, other_mask.get(i));
}
self.set_null_mask(Some(mask));
}
(None, None) => {
}
}
}
fn append_range(&mut self, other: &Self, offset: usize, len: usize) -> Result<(), $crate::enums::error::MinarrowError> {
if len == 0 { return Ok(()); }
if offset + len > other.len() {
return Err($crate::enums::error::MinarrowError::IndexError(
format!("append_range: offset {} + len {} exceeds source length {}", offset, len, other.len())
));
}
let orig_len = self.len();
self.data_mut().extend_from_slice(&other.data()[offset..offset + len]);
match (self.null_mask_mut(), other.null_mask()) {
(Some(self_mask), Some(other_mask)) => {
self_mask.extend_from_bitmask_range(other_mask, offset, len);
}
(Some(self_mask), None) => {
self_mask.resize(orig_len + len, true);
}
(None, Some(other_mask)) => {
let mut mask = Bitmask::new_set_all(orig_len, true);
mask.extend_from_bitmask_range(other_mask, offset, len);
self.set_null_mask(Some(mask));
}
(None, None) => {}
}
Ok(())
}
fn insert_rows(&mut self, index: usize, other: &Self) -> Result<(), $crate::enums::error::MinarrowError> {
let orig_len = self.len();
let other_len = other.len();
if index > orig_len {
return Err($crate::enums::error::MinarrowError::IndexError(format!(
"Index {} out of bounds for array of length {}",
index, orig_len
)));
}
if other_len == 0 {
return Ok(());
}
self.data.resize(orig_len + other_len, Default::default());
for i in (index..orig_len).rev() {
unsafe {
let val = *self.data.as_ref().get_unchecked(i);
*self.data.as_mut().get_unchecked_mut(i + other_len) = val;
}
}
for i in 0..other_len {
unsafe {
let val = *other.data.as_ref().get_unchecked(i);
*self.data.as_mut().get_unchecked_mut(index + i) = val;
}
}
match (self.null_mask_mut(), other.null_mask()) {
(Some(self_mask), Some(other_mask)) => {
self_mask.resize(orig_len + other_len, true);
for i in (index..orig_len).rev() {
unsafe {
let bit = self_mask.get_unchecked(i);
self_mask.set_unchecked(i + other_len, bit);
}
}
for i in 0..other_len {
unsafe {
let bit = other_mask.get_unchecked(i);
self_mask.set_unchecked(index + i, bit);
}
}
}
(Some(self_mask), None) => {
self_mask.resize(orig_len + other_len, true);
for i in (index..orig_len).rev() {
unsafe {
let bit = self_mask.get_unchecked(i);
self_mask.set_unchecked(i + other_len, bit);
}
}
for i in index..(index + other_len) {
unsafe {
self_mask.set_unchecked(i, true);
}
}
}
(None, Some(other_mask)) => {
let mut mask = Bitmask::new_set_all(orig_len + other_len, true);
for i in 0..other_len {
unsafe {
let bit = other_mask.get_unchecked(i);
mask.set_unchecked(index + i, bit);
}
}
self.set_null_mask(Some(mask));
}
(None, None) => {
}
}
Ok(())
}
fn split(mut self, index: usize) -> Result<(Self, Self), $crate::enums::error::MinarrowError> {
let len = self.len();
if index == 0 || index >= len {
return Err($crate::enums::error::MinarrowError::IndexError(format!(
"Split index {} must be > 0 and < array length {}",
index, len
)));
}
$(
let extra_val = self.$extra_field.clone();
)?
let after_data = self.data.split_off(index);
let after_mask = if let Some(ref mut mask) = self.null_mask {
Some(mask.split_off(index))
} else {
None
};
let before = Self {
data: self.data,
null_mask: self.null_mask,
$(
$extra_field: extra_val.clone(),
)?
};
let after = Self {
data: after_data,
null_mask: after_mask,
$(
$extra_field: extra_val,
)?
};
Ok((before, after))
}
fn extend_from_iter_with_capacity<I>(&mut self, iter: I, additional_capacity: usize)
where
I: Iterator<Item = Self::LogicalType>,
{
self.data.reserve(additional_capacity);
let values: Vec<Self::LogicalType> = iter.collect();
let start_len = self.len();
self.data.resize(start_len + values.len(), Default::default());
for (i, value) in values.iter().enumerate() {
unsafe { self.set_unchecked(start_len + i, *value) };
}
}
fn extend_from_slice(&mut self, slice: &[Self::LogicalType]) {
let start_len = self.len();
self.data.reserve(slice.len());
self.data.resize(start_len + slice.len(), Default::default());
for (i, value) in slice.iter().enumerate() {
unsafe { self.set_unchecked(start_len + i, *value) };
}
}
fn fill(value: Self::LogicalType, count: usize) -> Self {
let mut array = Self::default();
array.data.reserve(count);
array.data.resize(count, Default::default());
for i in 0..count {
unsafe { array.set_unchecked(i, value) };
}
array
}
}
#[cfg(feature = "parallel_proc")]
impl<T> $array<T>
where
T: $bound + Send + Sync + Copy + 'static
{
#[inline]
pub fn par_iter(&self) -> rayon::slice::Iter<'_, T> {
self.data.par_iter()
}
#[inline]
pub fn par_iter_opt(
&self
) -> impl rayon::prelude::ParallelIterator<Item = Option<&T>> + '_ {
use rayon::prelude::*;
let nmask = self.null_mask.as_ref();
self.data.par_iter().enumerate().map(move |(idx, val)| {
if nmask.map(|m| !m.get(idx)).unwrap_or(false) { None } else { Some(val) }
})
}
#[inline]
pub fn par_iter_mut(&mut self) -> rayon::slice::IterMut<'_, T> {
self.data.par_iter_mut()
}
#[inline]
pub fn par_iter_range(
&self,
start: usize,
end: usize
) -> impl rayon::prelude::ParallelIterator<Item = Option<&T>> + '_
where
for<'r> &'r T: Send
{
use rayon::prelude::*;
let nmask = self.null_mask.as_ref();
let data = &self.data;
debug_assert!(start <= end && end <= data.len());
(start..end).into_par_iter().map(move |i| {
if nmask.map(|m| !m.get(i)).unwrap_or(false) { None } else { Some(&data[i]) }
})
}
pub fn par_iter_range_opt(
&self,
start: usize,
end: usize
) -> impl rayon::prelude::ParallelIterator<Item = Option<&T>> + '_ {
use rayon::prelude::*;
let nmask = self.null_mask.as_ref();
let data = &self.data;
(start..end).into_par_iter().map(move |i| {
if nmask.map(|m| !m.get(i)).unwrap_or(false) { None } else { Some(&data[i]) }
})
}
#[inline]
pub unsafe fn par_iter_range_unchecked(
&self,
start: usize,
end: usize
) -> impl rayon::prelude::ParallelIterator<Item = &T> + '_ {
use rayon::prelude::*;
let data = &self.data;
(start..end).into_par_iter().map(move |i| unsafe { data.get_unchecked(i) })
}
#[inline]
pub unsafe fn par_iter_range_opt_unchecked(
&self,
start: usize,
end: usize
) -> impl rayon::prelude::ParallelIterator<Item = Option<&T>> + '_
where
for<'r> &'r T: Send
{
use rayon::prelude::*;
let nmask = self.null_mask.as_ref();
let data = &self.data;
(start..end).into_par_iter().map(move |i| unsafe {
if nmask.map(|m| !m.get_unchecked(i)).unwrap_or(false) {
None
} else {
Some(data.get_unchecked(i))
}
})
}
}
};
}
#[macro_export]
macro_rules! impl_from_vec_primitive {
($array:ident $(, $extra:tt )?) => {
impl<T> $array<T>
where
T: $crate::traits::type_unions::Primitive $( $extra )?
{
#[inline]
pub fn from_vec64(
data: $crate::Vec64<T>,
null_mask: Option<$crate::structs::bitmask::Bitmask>,
$($extra)? ) -> Self {
Self {
data: data.into(),
null_mask,
$(, $extra )? }
}
#[inline]
pub fn from_vec(
data: Vec<T>,
null_mask: Option<$crate::structs::bitmask::Bitmask>,
$($extra)?
) -> Self {
Self::from_vec64(data.into(), null_mask $(, $extra )?)
}
}
};
}
#[macro_export]
macro_rules! match_array {
($self:expr, $method:ident $(, $args:expr)* $(,)?) => {{
match $self {
Array::NumericArray(inner) => match inner {
#[cfg(feature = "extended_numeric_types")]
NumericArray::Int8(a) => a.$method($($args),*),
#[cfg(feature = "extended_numeric_types")]
NumericArray::Int16(a) => a.$method($($args),*),
NumericArray::Int32(a) => a.$method($($args),*),
NumericArray::Int64(a) => a.$method($($args),*),
#[cfg(feature = "extended_numeric_types")]
NumericArray::UInt8(a) => a.$method($($args),*),
#[cfg(feature = "extended_numeric_types")]
NumericArray::UInt16(a) => a.$method($($args),*),
NumericArray::UInt32(a) => a.$method($($args),*),
NumericArray::UInt64(a) => a.$method($($args),*),
NumericArray::Float32(a) => a.$method($($args),*),
NumericArray::Float64(a) => a.$method($($args),*),
NumericArray::Null => Default::default(),
},
Array::BooleanArray(a) => a.$method($($args),*),
Array::TextArray(inner) => match inner {
TextArray::String32(a) => a.$method($($args),*),
#[cfg(feature = "large_string")]
TextArray::String64(a) => a.$method($($args),*),
#[cfg(feature = "default_categorical_8")]
TextArray::Categorical8(a) => a.$method($($args),*),
#[cfg(feature = "extended_categorical")]
TextArray::Categorical16(a) => a.$method($($args),*),
#[cfg(any(not(feature = "default_categorical_8"), feature = "extended_categorical"))]
TextArray::Categorical32(a) => a.$method($($args),*),
#[cfg(feature = "extended_categorical")]
TextArray::Categorical64(a) => a.$method($($args),*),
TextArray::Null => Default::default(),
},
#[cfg(feature = "datetime")]
Array::TemporalArray(inner) => match inner {
TemporalArray::Datetime32(a) => a.$method($($args),*),
TemporalArray::Datetime64(a) => a.$method($($args),*),
TemporalArray::Null => Default::default(),
},
Array::Null => Default::default(),
}
}};
}
#[macro_export]
macro_rules! impl_usize_conversions {
($($t:ty),*) => {$(
impl Integer for $t {
#[inline] fn to_usize(self) -> usize { self as usize }
#[inline] fn from_usize(v: usize) -> Self {
v.try_into().expect("overflow casting usize -> offset type")
}
}
)*};
}
#[macro_export]
macro_rules! impl_array_ref_deref {
($array:ident < $t:ident > : $bound:path) => {
impl<$t: $bound> AsRef<[$t]> for $array<$t> {
#[inline]
fn as_ref(&self) -> &[$t] {
self.data.as_ref()
}
}
impl<$t: $bound> AsMut<[$t]> for $array<$t> {
#[inline]
fn as_mut(&mut self) -> &mut [$t] {
self.data.as_mut()
}
}
impl<$t: $bound> ::std::ops::Deref for $array<$t> {
type Target = [$t];
#[inline]
fn deref(&self) -> &Self::Target {
self.data.as_ref()
}
}
impl<$t: $bound> ::std::ops::DerefMut for $array<$t> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.data.as_mut()
}
}
};
($array:ident < $t:ident >) => {
impl<$t> AsRef<[$t]> for $array<$t> {
#[inline]
fn as_ref(&self) -> &[$t] {
self.data.as_ref()
}
}
impl<$t> AsMut<[$t]> for $array<$t> {
#[inline]
fn as_mut(&mut self) -> &mut [$t] {
self.data.as_mut()
}
}
impl<$t> ::std::ops::Deref for $array<$t> {
type Target = [$t];
#[inline]
fn deref(&self) -> &Self::Target {
self.data.as_ref()
}
}
impl<$t> ::std::ops::DerefMut for $array<$t> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.data.as_mut()
}
}
};
($array:ident) => {
impl AsRef<[u8]> for $array {
#[inline]
fn as_ref(&self) -> &[u8] {
self.data.as_ref()
}
}
impl AsMut<[u8]> for $array {
#[inline]
fn as_mut(&mut self) -> &mut [u8] {
self.data.as_mut()
}
}
impl ::std::ops::Deref for $array {
type Target = [u8];
#[inline]
fn deref(&self) -> &Self::Target {
self.data.as_ref()
}
}
impl ::std::ops::DerefMut for $array {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.data.as_mut()
}
}
};
}
#[macro_export]
macro_rules! impl_arc_masked_array {
(
Inner = $inner:ident < $T:ident >,
T = $T2:ident,
Container = $Container:ty,
LogicalType = $LogicalType:ty,
CopyType = $CopyType:ty,
BufferT = $BufferT:ty,
Variant = $variant:ident,
Bound = $Bound:path,
) => {
impl<$T: $Bound> $crate::traits::masked_array::MaskedArray
for ::std::sync::Arc<$inner<$T>>
{
type T = $T;
type Container = $Container;
type LogicalType = $LogicalType;
type CopyType = $CopyType;
fn len(&self) -> usize {
(**self).len()
}
fn is_empty(&self) -> bool {
(**self).is_empty()
}
fn data(&self) -> &Self::Container {
(**self).data()
}
fn data_mut(&mut self) -> &mut Self::Container {
::std::sync::Arc::make_mut(self).data_mut()
}
fn get(&self, idx: usize) -> Option<Self::CopyType> {
(**self).get(idx)
}
fn set(&mut self, idx: usize, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).set(idx, value)
}
unsafe fn get_unchecked(&self, idx: usize) -> Option<Self::CopyType> {
unsafe { (**self).get_unchecked(idx) }
}
unsafe fn set_unchecked(&mut self, idx: usize, value: Self::LogicalType) {
unsafe { ::std::sync::Arc::make_mut(self).set_unchecked(idx, value) }
}
fn iter(&self) -> impl Iterator<Item = Self::CopyType> + '_ {
(**self).iter()
}
fn iter_opt(&self) -> impl Iterator<Item = Option<Self::CopyType>> + '_ {
(**self).iter_opt()
}
fn iter_range(
&self,
offset: usize,
len: usize,
) -> impl Iterator<Item = Self::CopyType> + '_ {
(**self).iter_range(offset, len)
}
fn iter_opt_range(
&self,
offset: usize,
len: usize,
) -> impl Iterator<Item = Option<Self::CopyType>> + '_ {
(**self).iter_opt_range(offset, len)
}
fn push(&mut self, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).push(value)
}
unsafe fn push_unchecked(&mut self, value: Self::LogicalType) {
unsafe { ::std::sync::Arc::make_mut(self).push_unchecked(value) }
}
fn slice_clone(&self, offset: usize, len: usize) -> Self {
::std::sync::Arc::new((**self).slice_clone(offset, len))
}
fn resize(&mut self, n: usize, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).resize(n, value)
}
fn null_mask(&self) -> Option<&$crate::Bitmask> {
(**self).null_mask()
}
fn null_mask_mut(&mut self) -> Option<&mut $crate::Bitmask> {
::std::sync::Arc::make_mut(self).null_mask_mut()
}
fn set_null_mask(&mut self, mask: Option<$crate::Bitmask>) {
::std::sync::Arc::make_mut(self).set_null_mask(mask)
}
fn append_array(&mut self, other: &Self) {
::std::sync::Arc::make_mut(self).append_array(&**other)
}
fn append_range(&mut self, other: &Self, offset: usize, len: usize) -> Result<(), $crate::enums::error::MinarrowError> {
::std::sync::Arc::make_mut(self).append_range(&**other, offset, len)
}
fn insert_rows(
&mut self,
index: usize,
other: &Self,
) -> Result<(), $crate::enums::error::MinarrowError> {
::std::sync::Arc::make_mut(self).insert_rows(index, &**other)
}
fn split(
self,
index: usize,
) -> Result<(Self, Self), $crate::enums::error::MinarrowError> {
let inner = ::std::sync::Arc::try_unwrap(self).unwrap_or_else(|arc| (*arc).clone());
let (left, right) = inner.split(index)?;
Ok((::std::sync::Arc::new(left), ::std::sync::Arc::new(right)))
}
fn extend_from_iter_with_capacity<I>(&mut self, iter: I, additional_capacity: usize)
where
I: Iterator<Item = Self::LogicalType>,
{
::std::sync::Arc::make_mut(self)
.extend_from_iter_with_capacity(iter, additional_capacity)
}
fn extend_from_slice(&mut self, slice: &[Self::LogicalType]) {
::std::sync::Arc::make_mut(self).extend_from_slice(slice)
}
fn fill(value: Self::LogicalType, count: usize) -> Self {
::std::sync::Arc::new($inner::<$T>::fill(value, count))
}
}
};
(
Inner = $inner:ty,
T = $T:ty,
Container = $Container:ty,
LogicalType = $LogicalType:ty,
CopyType = $CopyType:ty,
BufferT = $BufferT:ty,
Variant = $variant:ident
) => {
impl $crate::traits::masked_array::MaskedArray for ::std::sync::Arc<$inner> {
type T = $T;
type Container = $Container;
type LogicalType = $LogicalType;
type CopyType = $CopyType;
fn len(&self) -> usize {
(**self).len()
}
fn is_empty(&self) -> bool {
(**self).is_empty()
}
fn data(&self) -> &Self::Container {
(**self).data()
}
fn data_mut(&mut self) -> &mut Self::Container {
::std::sync::Arc::make_mut(self).data_mut()
}
fn get(&self, idx: usize) -> Option<Self::CopyType> {
(**self).get(idx)
}
fn set(&mut self, idx: usize, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).set(idx, value)
}
unsafe fn get_unchecked(&self, idx: usize) -> Option<Self::CopyType> {
unsafe { (**self).get_unchecked(idx) }
}
unsafe fn set_unchecked(&mut self, idx: usize, value: Self::LogicalType) {
unsafe { ::std::sync::Arc::make_mut(self).set_unchecked(idx, value) }
}
fn iter(&self) -> impl Iterator<Item = Self::CopyType> + '_ {
(**self).iter()
}
fn iter_opt(&self) -> impl Iterator<Item = Option<Self::CopyType>> + '_ {
(**self).iter_opt()
}
fn iter_range(
&self,
offset: usize,
len: usize,
) -> impl Iterator<Item = Self::CopyType> + '_ {
(**self).iter_range(offset, len)
}
fn iter_opt_range(
&self,
offset: usize,
len: usize,
) -> impl Iterator<Item = Option<Self::CopyType>> + '_ {
(**self).iter_opt_range(offset, len)
}
fn push(&mut self, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).push(value)
}
unsafe fn push_unchecked(&mut self, value: Self::LogicalType) {
unsafe { ::std::sync::Arc::make_mut(self).push_unchecked(value) }
}
fn slice_clone(&self, offset: usize, len: usize) -> Self {
::std::sync::Arc::new((**self).slice_clone(offset, len))
}
fn resize(&mut self, n: usize, value: Self::LogicalType) {
::std::sync::Arc::make_mut(self).resize(n, value)
}
fn null_mask(&self) -> Option<&$crate::Bitmask> {
(**self).null_mask()
}
fn null_mask_mut(&mut self) -> Option<&mut $crate::Bitmask> {
::std::sync::Arc::make_mut(self).null_mask_mut()
}
fn set_null_mask(&mut self, mask: Option<$crate::Bitmask>) {
::std::sync::Arc::make_mut(self).set_null_mask(mask)
}
fn append_array(&mut self, other: &Self) {
::std::sync::Arc::make_mut(self).append_array(&**other)
}
fn append_range(&mut self, other: &Self, offset: usize, len: usize) -> Result<(), $crate::enums::error::MinarrowError> {
::std::sync::Arc::make_mut(self).append_range(&**other, offset, len)
}
fn insert_rows(
&mut self,
index: usize,
other: &Self,
) -> Result<(), $crate::enums::error::MinarrowError> {
::std::sync::Arc::make_mut(self).insert_rows(index, &**other)
}
fn split(
self,
index: usize,
) -> Result<(Self, Self), $crate::enums::error::MinarrowError> {
let inner = ::std::sync::Arc::try_unwrap(self).unwrap_or_else(|arc| (*arc).clone());
let (left, right) = inner.split(index)?;
Ok((::std::sync::Arc::new(left), ::std::sync::Arc::new(right)))
}
fn extend_from_iter_with_capacity<I>(&mut self, iter: I, additional_capacity: usize)
where
I: Iterator<Item = Self::LogicalType>,
{
::std::sync::Arc::make_mut(self)
.extend_from_iter_with_capacity(iter, additional_capacity)
}
fn extend_from_slice(&mut self, slice: &[Self::LogicalType]) {
::std::sync::Arc::make_mut(self).extend_from_slice(slice)
}
fn fill(value: Self::LogicalType, count: usize) -> Self {
::std::sync::Arc::new(<$inner>::fill(value, count))
}
}
};
}