pub struct Array {
pub value_type: VariantScalarTypeId,
pub values: Vec<Variant>,
pub dimensions: Option<Vec<u32>>,
}
Expand description
An array is a vector of values with an optional number of dimensions. It is expected that the multi-dimensional array is valid, or it might not be encoded or decoded properly. The dimensions should match the number of values, or the array is invalid.
Fields§
§value_type: VariantScalarTypeId
Type of elements in the array
values: Vec<Variant>
Values are stored sequentially
dimensions: Option<Vec<u32>>
Multi dimension array which can contain any scalar type, all the same type. Nested
arrays are rejected. Higher rank dimensions are serialized first. For example an array
with dimensions [2,2,2]
is written in this order - [0,0,0]
, [0,0,1]
, [0,1,0]
, [0,1,1]
,
[1,0,0]
, [1,0,1]
, [1,1,0]
, [1,1,1]
.
Implementations§
Source§impl Array
impl Array
Sourcepub fn new<V>(
value_type: VariantScalarTypeId,
values: V,
) -> Result<Array, ArrayError>
pub fn new<V>( value_type: VariantScalarTypeId, values: V, ) -> Result<Array, ArrayError>
Constructs a single dimension array from the supplied values
Sourcepub fn new_multi<V, D>(
value_type: VariantScalarTypeId,
values: V,
dimensions: D,
) -> Result<Array, ArrayError>
pub fn new_multi<V, D>( value_type: VariantScalarTypeId, values: V, dimensions: D, ) -> Result<Array, ArrayError>
Constructs a multi-dimensional array from the supplied values. The values are still provided and held as a single dimension array but a separate dimensions parameter indicates how the values are accessed.
Sourcepub fn encoding_mask(&self) -> u8
pub fn encoding_mask(&self) -> u8
Encoding mask.