pub struct NumericArrayV {
pub array: NumericArray,
pub offset: usize,
/* private fields */
}Expand description
§NumericArrayView
Read-only, zero-copy view over a [offset .. offset + len) window of a
NumericArray.
§Purpose
- Return an indexable subrange without cloning buffers.
- Optionally cache per-window null counts for faster repeated passes.
§Behaviour
- Groups integer and float variants under one enum.
- Upcasts via
get_f64for uniform handling. - Further slicing yields another borrowed view.
§Fields
array: backingNumericArray(enum over numeric types).offset: starting index into the backing array.len: logical number of elements in the view.null_count: cachedOption<usize>for this window (internal).
§Notes
- Not thread-safe due to
Cell. Create per-thread views withslice. - Use
to_numeric_arrayto materialise the window.
Fields§
§array: NumericArray§offset: usizeImplementations§
Source§impl NumericArrayV
impl NumericArrayV
Sourcepub fn new(array: NumericArray, offset: usize, len: usize) -> Self
pub fn new(array: NumericArray, offset: usize, len: usize) -> Self
Creates a new NumericArrayView with the given offset and length.
Sourcepub fn new_nc(
array: NumericArray,
offset: usize,
len: usize,
null_count: usize,
) -> Self
pub fn new_nc( array: NumericArray, offset: usize, len: usize, null_count: usize, ) -> Self
Creates a new NumericArrayView with a precomputed null count.
Sourcepub fn inner_array(&self) -> Array
pub fn inner_array(&self) -> Array
Returns the full backing array wrapped as an Array enum, ignoring the view’s offset and length.
Use this to access inner array methods. The returned array is the unwindowed original.
Sourcepub fn get_f64(&self, i: usize) -> Option<f64>
pub fn get_f64(&self, i: usize) -> Option<f64>
Returns the value at logical index i as f64, or None if out of bounds or null.
Converts any numeric types to f64, simplifying usage by avoiding explicit
enum matches in caller code.
§Notes
- Returns
Noneifiis out of bounds or the value is null. - Upcasts integer and float types to
f64for uniform downstream handling.
Sourcepub unsafe fn get_f64_unchecked(&self, i: usize) -> Option<f64>
pub unsafe fn get_f64_unchecked(&self, i: usize) -> Option<f64>
Unchecked, returns None for nulls, skips bounds check.
Converts any numeric types to f64, simplifying usage by avoiding explicit
enum matches in caller code.
Sourcepub fn slice(&self, offset: usize, len: usize) -> Self
pub fn slice(&self, offset: usize, len: usize) -> Self
Returns a windowed view into a sub-range of this view.
Sourcepub fn to_numeric_array(&self) -> NumericArray
pub fn to_numeric_array(&self) -> NumericArray
Materialise as an owned NumericArray for the window.
If the view covers the entire backing array, returns a cheap Arc clone
of the original variant. Otherwise deep-copies the window via
slice_clone through inner_array.
Sourcepub fn as_tuple(&self) -> (NumericArray, usize, usize)
pub fn as_tuple(&self) -> (NumericArray, usize, usize)
Returns the view as a tuple (array, offset, len).
Note: This clones the Arc-wrapped NumericArray.
Sourcepub fn as_tuple_ref(&self) -> (&NumericArray, usize, usize)
pub fn as_tuple_ref(&self) -> (&NumericArray, usize, usize)
Returns a reference tuple: (&NumericArray, offset, len).
This avoids cloning the Arc and returns a reference with a lifetime tied to this NumericArrayV.
Sourcepub fn null_count(&self) -> usize
pub fn null_count(&self) -> usize
Returns the number of nulls in the view.
Sourcepub fn has_nulls(&self) -> bool
pub fn has_nulls(&self) -> bool
Returns true when the windowed view holds at least one null.
Reads through null_count, so the cached value is trusted when set
and the full popcount is only paid on the first call that observes
this view.
Sourcepub fn null_mask_view(&self) -> Option<BitmaskV>
pub fn null_mask_view(&self) -> Option<BitmaskV>
Returns the null mask as a windowed BitmaskView.
Sourcepub fn set_null_count(&self, count: usize) -> Result<(), usize>
pub fn set_null_count(&self, count: usize) -> Result<(), usize>
Sets the cached null count for the view.
Returns Ok(()) if the value was set, or Err(count) if it was already initialised. This is thread-safe and can only succeed once per NumericArrayV instance.
Sourcepub fn guarantee_f64(&mut self) -> (&[f64], Option<&Bitmask>, Option<usize>)
pub fn guarantee_f64(&mut self) -> (&[f64], Option<&Bitmask>, Option<usize>)
Guarantees the backing array is Float64, then returns the f64 slice, null mask, and null count for this view’s window.
If already Float64, this is a pass-through. Otherwise the full backing
NumericArray is cast to Float64 via NumericArray::cow_into_f64,
preserving the window offset and length.
When multiple views share the same backing array, the first view to call this will trigger the cast. If it holds the sole Arc reference, the old data is consumed in place. If other references exist, the data is cloned, leaving the shared original untouched. Subsequent views that still reference the original will cast independently when they reach this call, so it generally is best avoided in such contexts as it would clone for every independent window view.
Trait Implementations§
Source§impl Clone for NumericArrayV
impl Clone for NumericArrayV
Source§fn clone(&self) -> NumericArrayV
fn clone(&self) -> NumericArrayV
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Concatenate for NumericArrayV
impl Concatenate for NumericArrayV
Source§fn concat(self, other: Self) -> Result<Self, MinarrowError>
fn concat(self, other: Self) -> Result<Self, MinarrowError>
Concatenates two numeric array views by materialising both to owned numeric arrays, concatenating them, and wrapping the result back in a view.
§Notes
- This operation copies data from both views to create owned numeric arrays.
- The resulting view has offset=0 and length equal to the combined length.
Source§impl Debug for NumericArrayV
impl Debug for NumericArrayV
Source§impl Display for NumericArrayV
impl Display for NumericArrayV
Source§impl From<Array> for NumericArrayV
impl From<Array> for NumericArrayV
Source§impl From<ArrayV> for NumericArrayV
impl From<ArrayV> for NumericArrayV
Source§impl From<FieldArray> for NumericArrayV
impl From<FieldArray> for NumericArrayV
Source§fn from(field_array: FieldArray) -> Self
fn from(field_array: FieldArray) -> Self
Source§impl From<NumericArray> for NumericArrayV
impl From<NumericArray> for NumericArrayV
Source§fn from(array: NumericArray) -> Self
fn from(array: NumericArray) -> Self
Source§impl From<NumericArrayV> for Value
Available on crate feature views only.Wrap a NumericArrayV as Value::ArrayView. The view’s offset and length
are preserved; the inner NumericArray flows through Array::NumericArray.
impl From<NumericArrayV> for Value
views only.Wrap a NumericArrayV as Value::ArrayView. The view’s offset and length
are preserved; the inner NumericArray flows through Array::NumericArray.
Source§fn from(v: NumericArrayV) -> Self
fn from(v: NumericArrayV) -> Self
Source§impl From<NumericArrayV> for ArrayV
Available on crate feature views only.NumericArrayView -> ArrayView
impl From<NumericArrayV> for ArrayV
views only.NumericArrayView -> ArrayView
Converts by wrapping the inner NumericArray as Array::NumericArray.
Source§fn from(view: NumericArrayV) -> Self
fn from(view: NumericArrayV) -> Self
Source§impl PartialEq for NumericArrayV
impl PartialEq for NumericArrayV
Source§fn eq(&self, other: &NumericArrayV) -> bool
fn eq(&self, other: &NumericArrayV) -> bool
self and other values to be equal, and is used by ==.Source§impl Shape for NumericArrayV
impl Shape for NumericArrayV
impl StructuralPartialEq for NumericArrayV
Auto Trait Implementations§
impl !Freeze for NumericArrayV
impl RefUnwindSafe for NumericArrayV
impl Send for NumericArrayV
impl Sync for NumericArrayV
impl Unpin for NumericArrayV
impl UnsafeUnpin for NumericArrayV
impl UnwindSafe for NumericArrayV
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CustomValue for T
impl<T> CustomValue for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
impl<T> PlanCallbackArgs for T
impl<T> PlanCallbackOut for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more