pub struct Array {
pub value_type: VariantTypeId,
pub values: Vec<Variant>,
pub dimensions: 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: VariantTypeId§values: Vec<Variant>Values are stored sequentially
dimensions: 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
pub fn new_single<V>( value_type: VariantTypeId, values: V, ) -> Result<Array, StatusCode>
pub fn new_multi<V, D>( value_type: VariantTypeId, values: V, dimensions: D, ) -> Result<Array, StatusCode>
pub fn is_valid(&self) -> bool
pub fn has_dimensions(&self) -> bool
pub fn encoding_mask(&self) -> u8
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Array
impl<'de> Deserialize<'de> for Array
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Array, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Array, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Array
impl Serialize for Array
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Array
Auto Trait Implementations§
impl Freeze for Array
impl RefUnwindSafe for Array
impl Send for Array
impl Sync for Array
impl Unpin for Array
impl UnwindSafe for Array
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
Mutably borrows from an owned value. Read more