pub enum Value {
Show 21 variants
Scalar(Scalar),
Array(Arc<Array>),
ArrayView(Arc<ArrayV>),
FieldArray(Arc<FieldArray>),
Table(Arc<Table>),
TableView(Arc<TableV>),
SuperArray(Arc<SuperArray>),
SuperArrayView(Arc<SuperArrayV>),
SuperTable(Arc<SuperTable>),
SuperTableView(Arc<SuperTableV>),
Matrix(Arc<Matrix>),
Cube(Arc<Cube>),
VecValue(Arc<Vec<Value>>),
BoxValue(Box<Value>),
ArcValue(Arc<Value>),
Tuple2(Arc<(Value, Value)>),
Tuple3(Arc<(Value, Value, Value)>),
Tuple4(Arc<(Value, Value, Value, Value)>),
Tuple5(Arc<(Value, Value, Value, Value, Value)>),
Tuple6(Arc<(Value, Value, Value, Value, Value, Value)>),
Custom(Arc<dyn CustomValue>),
}Expand description
§Value
Unified value enum representing any supported data structure.
§Details
- Wraps scalar values, arrays, array windows, full tables, or table windows under a single type for function signatures and downstream dispatch.
- This can be useful when you need a global type universe.
- It is not part of the
Arrowspecification, but is useful because of the flexibility it adds unifying all types to a single one. For example, to returnResult<Value, Error>, particularly in engine contexts. - It’s enabled optionally via the
value_typefeature.
§Usage
You can also use it to hold a custom type under the Custom entry.
As long as the object implements Debug, Clone, and PartialEq,
remains Send + Sync, and implements Any it can be stored in Value::Custom.
Any is implemented automatically for all Rust types with a 'static lifetime.
Variants§
Scalar(Scalar)
Array(Arc<Array>)
ArrayView(Arc<ArrayV>)
FieldArray(Arc<FieldArray>)
Table(Arc<Table>)
TableView(Arc<TableV>)
SuperArray(Arc<SuperArray>)
SuperArrayView(Arc<SuperArrayV>)
SuperTable(Arc<SuperTable>)
SuperTableView(Arc<SuperTableV>)
Matrix(Arc<Matrix>)
Cube(Arc<Cube>)
VecValue(Arc<Vec<Value>>)
BoxValue(Box<Value>)
ArcValue(Arc<Value>)
Tuple2(Arc<(Value, Value)>)
Tuple3(Arc<(Value, Value, Value)>)
Tuple4(Arc<(Value, Value, Value, Value)>)
Tuple5(Arc<(Value, Value, Value, Value, Value)>)
Tuple6(Arc<(Value, Value, Value, Value, Value, Value)>)
Custom(Arc<dyn CustomValue>)
Arbitrary user or library-defined payload.
As long as the object implements Debug, Clone, and PartialEq,
remains Send + Sync, and implements Any it can be stored in Value::Custom.
Any is implemented automatically for all Rust types with a 'static lifetime.
Borrowed values cannot be used directly.
These must be wrapped in Arc or otherwise promoted to 'static to
store inside Value.
It’s recommended that creators also implement From and TryFrom.
Implementations§
Source§impl Value
impl Value
Sourcepub fn scalar(&self) -> &Scalar
pub fn scalar(&self) -> &Scalar
Returns the inner Scalar if this is a Value::Scalar.
Panics if the value is not a Scalar variant.
Sourcepub fn try_scalar(&self) -> Result<&Scalar, MinarrowError>
pub fn try_scalar(&self) -> Result<&Scalar, MinarrowError>
Returns the inner Scalar if this is a Value::Scalar, or an error otherwise.
Sourcepub fn arr(&self) -> &Array
pub fn arr(&self) -> &Array
Returns the inner Array if this is a Value::Array.
Panics if the value is not an Array variant.
Sourcepub fn try_arr(&self) -> Result<&Array, MinarrowError>
pub fn try_arr(&self) -> Result<&Array, MinarrowError>
Returns the inner Array if this is a Value::Array, or an error otherwise.
Sourcepub fn av(&self) -> &ArrayV
pub fn av(&self) -> &ArrayV
Returns the inner ArrayV if this is a Value::ArrayView.
Panics if the value is not an ArrayView variant.
Sourcepub fn try_av(&self) -> Result<&ArrayV, MinarrowError>
pub fn try_av(&self) -> Result<&ArrayV, MinarrowError>
Returns the inner ArrayV if this is a Value::ArrayView, or an error otherwise.
Sourcepub fn fa(&self) -> &FieldArray
pub fn fa(&self) -> &FieldArray
Returns the inner FieldArray if this is a Value::FieldArray.
Panics if the value is not a FieldArray variant.
Sourcepub fn try_fa(&self) -> Result<&FieldArray, MinarrowError>
pub fn try_fa(&self) -> Result<&FieldArray, MinarrowError>
Returns the inner FieldArray if this is a Value::FieldArray, or an error otherwise.
Sourcepub fn table(&self) -> &Table
pub fn table(&self) -> &Table
Returns the inner Table if this is a Value::Table.
Panics if the value is not a Table variant.
Sourcepub fn try_table(&self) -> Result<&Table, MinarrowError>
pub fn try_table(&self) -> Result<&Table, MinarrowError>
Returns the inner Table if this is a Value::Table, or an error otherwise.
Sourcepub fn tv(&self) -> &TableV
pub fn tv(&self) -> &TableV
Returns the inner TableV if this is a Value::TableView.
Panics if the value is not a TableView variant.
Sourcepub fn try_tv(&self) -> Result<&TableV, MinarrowError>
pub fn try_tv(&self) -> Result<&TableV, MinarrowError>
Returns the inner TableV if this is a Value::TableView, or an error otherwise.
Sourcepub fn sa(&self) -> &SuperArray
pub fn sa(&self) -> &SuperArray
Returns the inner SuperArray if this is a Value::SuperArray.
Panics if the value is not a SuperArray variant.
Sourcepub fn try_sa(&self) -> Result<&SuperArray, MinarrowError>
pub fn try_sa(&self) -> Result<&SuperArray, MinarrowError>
Returns the inner SuperArray if this is a Value::SuperArray, or an error otherwise.
Sourcepub fn sav(&self) -> &SuperArrayV
pub fn sav(&self) -> &SuperArrayV
Returns the inner SuperArrayV if this is a Value::SuperArrayView.
Panics if the value is not a SuperArrayView variant.
Sourcepub fn try_sav(&self) -> Result<&SuperArrayV, MinarrowError>
pub fn try_sav(&self) -> Result<&SuperArrayV, MinarrowError>
Returns the inner SuperArrayV if this is a Value::SuperArrayView, or an error otherwise.
Sourcepub fn st(&self) -> &SuperTable
pub fn st(&self) -> &SuperTable
Returns the inner SuperTable if this is a Value::SuperTable.
Panics if the value is not a SuperTable variant.
Sourcepub fn try_st(&self) -> Result<&SuperTable, MinarrowError>
pub fn try_st(&self) -> Result<&SuperTable, MinarrowError>
Returns the inner SuperTable if this is a Value::SuperTable, or an error otherwise.
Sourcepub fn stv(&self) -> &SuperTableV
pub fn stv(&self) -> &SuperTableV
Returns the inner SuperTableV if this is a Value::SuperTableView.
Panics if the value is not a SuperTableView variant.
Sourcepub fn try_stv(&self) -> Result<&SuperTableV, MinarrowError>
pub fn try_stv(&self) -> Result<&SuperTableV, MinarrowError>
Returns the inner SuperTableV if this is a Value::SuperTableView, or an error otherwise.
Sourcepub fn mat(&self) -> &Matrix
pub fn mat(&self) -> &Matrix
Returns the inner Matrix if this is a Value::Matrix.
Panics if the value is not a Matrix variant.
Sourcepub fn try_mat(&self) -> Result<&Matrix, MinarrowError>
pub fn try_mat(&self) -> Result<&Matrix, MinarrowError>
Returns the inner Matrix if this is a Value::Matrix, or an error otherwise.
Sourcepub fn cube(&self) -> &Cube
pub fn cube(&self) -> &Cube
Returns the inner Cube if this is a Value::Cube.
Panics if the value is not a Cube variant.
Sourcepub fn try_cube(&self) -> Result<&Cube, MinarrowError>
pub fn try_cube(&self) -> Result<&Cube, MinarrowError>
Returns the inner Cube if this is a Value::Cube, or an error otherwise.
Sourcepub fn vec_val(&self) -> &Vec<Value>
pub fn vec_val(&self) -> &Vec<Value>
Returns the inner Vec<Value> if this is a Value::VecValue.
Panics if the value is not a VecValue variant.
Sourcepub fn try_vec_val(&self) -> Result<&Vec<Value>, MinarrowError>
pub fn try_vec_val(&self) -> Result<&Vec<Value>, MinarrowError>
Returns the inner Vec<Value> if this is a Value::VecValue, or an error otherwise.
Sourcepub fn box_val(&self) -> &Value
pub fn box_val(&self) -> &Value
Returns the inner Value if this is a Value::BoxValue.
Panics if the value is not a BoxValue variant.
Sourcepub fn try_box_val(&self) -> Result<&Value, MinarrowError>
pub fn try_box_val(&self) -> Result<&Value, MinarrowError>
Returns the inner Value if this is a Value::BoxValue, or an error otherwise.
Sourcepub fn arc_val(&self) -> &Value
pub fn arc_val(&self) -> &Value
Returns the inner Value if this is a Value::ArcValue.
Panics if the value is not an ArcValue variant.
Sourcepub fn try_arc_val(&self) -> Result<&Value, MinarrowError>
pub fn try_arc_val(&self) -> Result<&Value, MinarrowError>
Returns the inner Value if this is a Value::ArcValue, or an error otherwise.
Sourcepub fn t2(&self) -> &(Value, Value)
pub fn t2(&self) -> &(Value, Value)
Returns the inner tuple if this is a Value::Tuple2.
Panics if the value is not a Tuple2 variant.
Sourcepub fn try_t2(&self) -> Result<&(Value, Value), MinarrowError>
pub fn try_t2(&self) -> Result<&(Value, Value), MinarrowError>
Returns the inner tuple if this is a Value::Tuple2, or an error otherwise.
Sourcepub fn t3(&self) -> &(Value, Value, Value)
pub fn t3(&self) -> &(Value, Value, Value)
Returns the inner tuple if this is a Value::Tuple3.
Panics if the value is not a Tuple3 variant.
Sourcepub fn try_t3(&self) -> Result<&(Value, Value, Value), MinarrowError>
pub fn try_t3(&self) -> Result<&(Value, Value, Value), MinarrowError>
Returns the inner tuple if this is a Value::Tuple3, or an error otherwise.
Sourcepub fn t4(&self) -> &(Value, Value, Value, Value)
pub fn t4(&self) -> &(Value, Value, Value, Value)
Returns the inner tuple if this is a Value::Tuple4.
Panics if the value is not a Tuple4 variant.
Sourcepub fn try_t4(&self) -> Result<&(Value, Value, Value, Value), MinarrowError>
pub fn try_t4(&self) -> Result<&(Value, Value, Value, Value), MinarrowError>
Returns the inner tuple if this is a Value::Tuple4, or an error otherwise.
Sourcepub fn t5(&self) -> &(Value, Value, Value, Value, Value)
pub fn t5(&self) -> &(Value, Value, Value, Value, Value)
Returns the inner tuple if this is a Value::Tuple5.
Panics if the value is not a Tuple5 variant.
Sourcepub fn try_t5(
&self,
) -> Result<&(Value, Value, Value, Value, Value), MinarrowError>
pub fn try_t5( &self, ) -> Result<&(Value, Value, Value, Value, Value), MinarrowError>
Returns the inner tuple if this is a Value::Tuple5, or an error otherwise.
Sourcepub fn t6(&self) -> &(Value, Value, Value, Value, Value, Value)
pub fn t6(&self) -> &(Value, Value, Value, Value, Value, Value)
Returns the inner tuple if this is a Value::Tuple6.
Panics if the value is not a Tuple6 variant.
Sourcepub fn try_t6(
&self,
) -> Result<&(Value, Value, Value, Value, Value, Value), MinarrowError>
pub fn try_t6( &self, ) -> Result<&(Value, Value, Value, Value, Value, Value), MinarrowError>
Returns the inner tuple if this is a Value::Tuple6, or an error otherwise.
Sourcepub fn custom(&self) -> &dyn CustomValue
pub fn custom(&self) -> &dyn CustomValue
Returns the inner CustomValue trait object if this is a Value::Custom.
Panics if the value is not a Custom variant.
Sourcepub fn try_custom(&self) -> Result<&dyn CustomValue, MinarrowError>
pub fn try_custom(&self) -> Result<&dyn CustomValue, MinarrowError>
Returns the inner CustomValue trait object if this is a Value::Custom, or an error otherwise.
Source§impl Value
impl Value
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Computes the logical row/element count for the batch’s input Value.
This normalises the various Value representations so callers can consistently pass a
[start, len) range to execute_fn.
Sourcepub fn slice(&self, offset: usize, length: usize) -> Value
pub fn slice(&self, offset: usize, length: usize) -> Value
Returns a zero-copy view over [offset .. offset + length) rows of this Value.
For table and array types this returns the corresponding view variant. For scalars, returns a clone since they are dimensionless. For recursive wrappers, delegates to the inner value. For tuples, slices each element independently.
Trait Implementations§
Source§impl ByteSize for Value
Available on crate feature value_type only.ByteSize for Value enum - delegates to inner types
impl ByteSize for Value
value_type only.ByteSize for Value enum - delegates to inner types
Source§impl Concatenate for Value
impl Concatenate for Value
Source§impl From<FieldArray> for Value
impl From<FieldArray> for Value
Source§fn from(v: FieldArray) -> Self
fn from(v: FieldArray) -> Self
Source§impl From<SuperArray> for Value
Available on crate feature chunked only.
impl From<SuperArray> for Value
chunked only.Source§fn from(v: SuperArray) -> Self
fn from(v: SuperArray) -> Self
Source§impl From<SuperArrayV> for Value
Available on crate features chunked and views only.
impl From<SuperArrayV> for Value
chunked and views only.Source§fn from(v: SuperArrayV) -> Self
fn from(v: SuperArrayV) -> Self
Source§impl From<SuperTable> for Value
Available on crate feature chunked only.
impl From<SuperTable> for Value
chunked only.Source§fn from(v: SuperTable) -> Self
fn from(v: SuperTable) -> Self
Source§impl FromIterator<Value> for Value
Collect Values back from an iterator.
impl FromIterator<Value> for Value
Collect Values back from an iterator.
Zero items produces an empty VecValue. A single item is returned directly. Multiple items are wrapped in VecValue.
Source§impl IntoIterator for Value
Iterate over the elements of a Value.
impl IntoIterator for Value
Iterate over the elements of a Value.
VecValue yields its inner items. All other variants yield themselves as a single element, supporting keep-or-drop filter semantics.
Source§impl PartialEq for Value
Implements PartialEq for Value
impl PartialEq for Value
Implements PartialEq for Value
This includes special handling for the Custom type.
Source§impl Shape for Value
impl Shape for Value
Source§impl TryFrom<Value> for FieldArray
impl TryFrom<Value> for FieldArray
Source§impl TryFrom<Value> for NumericArrayV
Available on crate feature views only.
impl TryFrom<Value> for NumericArrayV
views only.Source§impl TryFrom<Value> for SuperArray
Available on crate feature chunked only.
impl TryFrom<Value> for SuperArray
chunked only.Source§impl TryFrom<Value> for SuperArrayV
Available on crate features chunked and views only.
impl TryFrom<Value> for SuperArrayV
chunked and views only.Source§impl TryFrom<Value> for SuperTable
Available on crate feature chunked only.
impl TryFrom<Value> for SuperTable
chunked only.Source§impl TryFrom<Value> for TemporalArrayV
Available on crate features views and datetime only.
impl TryFrom<Value> for TemporalArrayV
views and datetime only.Source§impl TryFrom<Value> for TextArrayV
Available on crate feature views only.
impl TryFrom<Value> for TextArrayV
views only.impl Eq for Value
Implements Eq for Value
Since PartialEq is reflexive, symmetric, and transitive for Value, we can safely implement Eq.
Auto Trait Implementations§
impl Freeze for Value
impl !RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl !UnwindSafe for Value
Blanket Implementations§
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
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more