pub struct ProductValue {
pub elements: Box<[AlgebraicValue]>,
}Expand description
A product value is made of a list of
“elements” / “fields” / “factors” of other AlgebraicValues.
The type of a product value is a product type.
Fields§
§elements: Box<[AlgebraicValue]>The values that make up this product value.
Implementations§
Source§impl ProductValue
impl ProductValue
Sourcepub fn decode<'a>(
ty: &<ProductValue as Value>::Type,
bytes: &mut impl BufReader<'a>,
) -> Result<ProductValue, DecodeError>
pub fn decode<'a>( ty: &<ProductValue as Value>::Type, bytes: &mut impl BufReader<'a>, ) -> Result<ProductValue, DecodeError>
Decode a value from bytes typed at ty.
Sourcepub fn decode_smallvec<'a>(
ty: &<ProductValue as Value>::Type,
bytes: &mut impl BufReader<'a>,
) -> Result<SmallVec<[ProductValue; 1]>, DecodeError>
pub fn decode_smallvec<'a>( ty: &<ProductValue as Value>::Type, bytes: &mut impl BufReader<'a>, ) -> Result<SmallVec<[ProductValue; 1]>, DecodeError>
Decode a vector of values from bytes with each value typed at ty.
pub fn encode(&self, bytes: &mut impl BufWriter)
Source§impl ProductValue
impl ProductValue
Sourcepub fn get_field(
&self,
col_pos: usize,
name: Option<&'static str>,
) -> Result<&AlgebraicValue, InvalidFieldError>
pub fn get_field( &self, col_pos: usize, name: Option<&'static str>, ) -> Result<&AlgebraicValue, InvalidFieldError>
Borrow the value at field of self identified by col_pos.
The name is non-functional and is only used for error-messages.
Sourcepub fn project(
&self,
cols: &ColList,
) -> Result<AlgebraicValue, InvalidFieldError>
pub fn project( &self, cols: &ColList, ) -> Result<AlgebraicValue, InvalidFieldError>
This utility function is designed to project fields based on the supplied indexes.
Important:
The resulting AlgebraicValue will wrap into a ProductValue when projecting multiple (including zero) fields, otherwise it will consist of a single AlgebraicValue.
Parameters:
cols: A ColList containing the indexes of fields to be projected.
Sourcepub fn extract_field<'a, T>(
&'a self,
col_pos: usize,
name: Option<&'static str>,
f: impl Fn(&'a AlgebraicValue) -> Option<T> + 'a,
) -> Result<T, InvalidFieldError>
pub fn extract_field<'a, T>( &'a self, col_pos: usize, name: Option<&'static str>, f: impl Fn(&'a AlgebraicValue) -> Option<T> + 'a, ) -> Result<T, InvalidFieldError>
Extracts the value at field of self identified by index
and then runs it through the function f which possibly returns a T derived from value.
Sourcepub fn field_as_bool(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<bool, InvalidFieldError>
pub fn field_as_bool( &self, index: usize, named: Option<&'static str>, ) -> Result<bool, InvalidFieldError>
Interprets the value at field of self identified by index as a bool.
Sourcepub fn field_as_u8(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<u8, InvalidFieldError>
pub fn field_as_u8( &self, index: usize, named: Option<&'static str>, ) -> Result<u8, InvalidFieldError>
Interprets the value at field of self identified by index as a u8.
Sourcepub fn field_as_u32(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<u32, InvalidFieldError>
pub fn field_as_u32( &self, index: usize, named: Option<&'static str>, ) -> Result<u32, InvalidFieldError>
Interprets the value at field of self identified by index as a u32.
Sourcepub fn field_as_u64(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<u64, InvalidFieldError>
pub fn field_as_u64( &self, index: usize, named: Option<&'static str>, ) -> Result<u64, InvalidFieldError>
Interprets the value at field of self identified by index as a u64.
Sourcepub fn field_as_i64(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<i64, InvalidFieldError>
pub fn field_as_i64( &self, index: usize, named: Option<&'static str>, ) -> Result<i64, InvalidFieldError>
Interprets the value at field of self identified by index as a i64.
Sourcepub fn field_as_i128(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<i128, InvalidFieldError>
pub fn field_as_i128( &self, index: usize, named: Option<&'static str>, ) -> Result<i128, InvalidFieldError>
Interprets the value at field of self identified by index as a i128.
Sourcepub fn field_as_u128(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<u128, InvalidFieldError>
pub fn field_as_u128( &self, index: usize, named: Option<&'static str>, ) -> Result<u128, InvalidFieldError>
Interprets the value at field of self identified by index as a u128.
Sourcepub fn field_as_str(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<&str, InvalidFieldError>
pub fn field_as_str( &self, index: usize, named: Option<&'static str>, ) -> Result<&str, InvalidFieldError>
Interprets the value at field of self identified by index as a string slice.
Sourcepub fn field_as_bytes(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<&[u8], InvalidFieldError>
pub fn field_as_bytes( &self, index: usize, named: Option<&'static str>, ) -> Result<&[u8], InvalidFieldError>
Interprets the value at field of self identified by index as a byte slice.
Sourcepub fn field_as_array(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<&ArrayValue, InvalidFieldError>
pub fn field_as_array( &self, index: usize, named: Option<&'static str>, ) -> Result<&ArrayValue, InvalidFieldError>
Interprets the value at field of self identified by index as an ArrayValue.
Sourcepub fn field_as_sum(
&self,
index: usize,
named: Option<&'static str>,
) -> Result<SumValue, InvalidFieldError>
pub fn field_as_sum( &self, index: usize, named: Option<&'static str>, ) -> Result<SumValue, InvalidFieldError>
Interprets the value at field of self identified by index as a SumValue.
Trait Implementations§
Source§impl Clone for ProductValue
impl Clone for ProductValue
Source§fn clone(&self) -> ProductValue
fn clone(&self) -> ProductValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProductValue
impl Debug for ProductValue
Source§impl Default for ProductValue
impl Default for ProductValue
Source§fn default() -> ProductValue
fn default() -> ProductValue
Source§impl From<AlgebraicValue> for ProductValue
impl From<AlgebraicValue> for ProductValue
Source§fn from(x: AlgebraicValue) -> ProductValue
fn from(x: AlgebraicValue) -> ProductValue
Source§impl From<ProductValue> for AlgebraicValue
impl From<ProductValue> for AlgebraicValue
Source§fn from(original: ProductValue) -> AlgebraicValue
fn from(original: ProductValue) -> AlgebraicValue
Source§impl<X> From<X> for ProductValue
impl<X> From<X> for ProductValue
Source§fn from(elements: X) -> ProductValue
fn from(elements: X) -> ProductValue
Source§impl FromIterator<AlgebraicValue> for ProductValue
impl FromIterator<AlgebraicValue> for ProductValue
Source§fn from_iter<T>(iter: T) -> ProductValuewhere
T: IntoIterator<Item = AlgebraicValue>,
fn from_iter<T>(iter: T) -> ProductValuewhere
T: IntoIterator<Item = AlgebraicValue>,
Source§impl Hash for ProductValue
The hash function for ProductValue does not length prefix.
impl Hash for ProductValue
The hash function for ProductValue does not length prefix.
Source§impl<'a> IntoIterator for &'a ProductValue
impl<'a> IntoIterator for &'a ProductValue
Source§type Item = &'a AlgebraicValue
type Item = &'a AlgebraicValue
Source§type IntoIter = Iter<'a, AlgebraicValue>
type IntoIter = Iter<'a, AlgebraicValue>
Source§fn into_iter(self) -> <&'a ProductValue as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a ProductValue as IntoIterator>::IntoIter
Source§impl IntoIterator for ProductValue
impl IntoIterator for ProductValue
Source§type Item = AlgebraicValue
type Item = AlgebraicValue
Source§type IntoIter = IntoIter<AlgebraicValue>
type IntoIter = IntoIter<AlgebraicValue>
Source§fn into_iter(self) -> <ProductValue as IntoIterator>::IntoIter
fn into_iter(self) -> <ProductValue as IntoIterator>::IntoIter
Source§impl Ord for ProductValue
impl Ord for ProductValue
Source§fn cmp(&self, other: &ProductValue) -> Ordering
fn cmp(&self, other: &ProductValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ProductValue
impl PartialEq for ProductValue
Source§impl PartialOrd for ProductValue
impl PartialOrd for ProductValue
Source§impl Serialize for ProductValue
impl Serialize for ProductValue
Source§fn serialize<S>(
&self,
ser: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
ser: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
self in the data format of S using the provided serializer.Source§impl Serialize for ProductValue
impl Serialize for ProductValue
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,
Source§impl SizeOf for ProductValue
impl SizeOf for ProductValue
Source§fn size_of(&self) -> usize
fn size_of(&self) -> usize
Source§impl ToBsatn for ProductValue
impl ToBsatn for ProductValue
Source§fn to_bsatn_vec(&self) -> Result<Vec<u8>, BsatnError>
fn to_bsatn_vec(&self) -> Result<Vec<u8>, BsatnError>
self into a freshly-allocated Vec<u8>.Source§fn to_bsatn_extend(&self, buf: &mut Vec<u8>) -> Result<(), BsatnError>
fn to_bsatn_extend(&self, buf: &mut Vec<u8>) -> Result<(), BsatnError>
self into buf,
pushing self’s bytes onto the end of buf, similar to Vec::extend.Source§impl Value for ProductValue
impl Value for ProductValue
Source§type Type = ProductType
type Type = ProductType
impl Eq for ProductValue
impl StructuralPartialEq for ProductValue
Auto Trait Implementations§
impl Freeze for ProductValue
impl RefUnwindSafe for ProductValue
impl Send for ProductValue
impl Sync for ProductValue
impl Unpin for ProductValue
impl UnwindSafe for ProductValue
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> 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> Satn for T
impl<T> Satn for T
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f.Source§fn fmt_psql(
&self,
f: &mut Formatter<'_>,
ty: &PsqlType<'_>,
) -> Result<(), Error>
fn fmt_psql( &self, f: &mut Formatter<'_>, ty: &PsqlType<'_>, ) -> Result<(), Error>
f.Source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
String.Source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
String.