pub struct ProductValue {
    pub elements: Vec<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: Vec<AlgebraicValue>

The values that make up this product value.

Implementations§

source§

impl ProductValue

source

pub fn decode<'a>( ty: &<Self as Value>::Type, bytes: &mut impl BufReader<'a> ) -> Result<Self, DecodeError>

Decode a value from bytes typed at ty.

source

pub fn decode_smallvec<'a>( ty: &<Self as Value>::Type, bytes: &mut impl BufReader<'a> ) -> Result<SmallVec<[Self; 1]>, DecodeError>

Decode a vector of values from bytes with each value typed at ty.

source

pub fn encode(&self, bytes: &mut impl BufWriter)

source§

impl ProductValue

source

pub fn new(elements: &[AlgebraicValue]) -> Self

Returns a product value constructed from the given values in elements.

source§

impl ProductValue

source

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.

source

pub fn project( &self, indexes: &[(ColId, Option<&'static str>)] ) -> Result<AlgebraicValue, InvalidFieldError>

This function is used to project fields based on the provided indexes.

It will raise an InvalidFieldError if any of the supplied indexes cannot be found.

The optional parameter name: Option<&'static str> serves a non-functional role and is solely utilized for generating error messages.

Important:

The resulting AlgebraicValue will wrap into a ProductValue when projecting multiple fields, otherwise it will consist of a single AlgebraicValue.

source

pub fn project_not_empty( &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 fields, otherwise it will consist of a single AlgebraicValue.

Parameters:

  • cols: A ColList containing the indexes of fields to be projected.
source

pub fn extract_field<'a, T>( &'a self, col_pos: usize, name: Option<&'static str>, f: impl 'a + Fn(&'a AlgebraicValue) -> Option<T> ) -> 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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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

source§

fn clone(&self) -> ProductValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProductValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&AlgebraicValue> for ProductValue

source§

fn from(x: &AlgebraicValue) -> Self

Converts to this type from the input type.
source§

impl From<AlgebraicValue> for ProductValue

source§

fn from(x: AlgebraicValue) -> Self

Converts to this type from the input type.
source§

impl From<ProductValue> for AlgebraicValue

source§

fn from(original: ProductValue) -> AlgebraicValue

Converts to this type from the input type.
source§

impl FromIterator<AlgebraicValue> for ProductValue

source§

fn from_iter<T: IntoIterator<Item = AlgebraicValue>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for ProductValue

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> IntoIterator for &'a ProductValue

§

type Item = &'a AlgebraicValue

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, AlgebraicValue>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for ProductValue

§

type Item = AlgebraicValue

The type of the elements being iterated over.
§

type IntoIter = IntoIter<AlgebraicValue>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl Ord for ProductValue

source§

fn cmp(&self, other: &ProductValue) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for ProductValue

source§

fn eq(&self, other: &ProductValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ProductValue

source§

fn partial_cmp(&self, other: &ProductValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for ProductValue

source§

fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error>

Serialize self in the data format of S using the provided serializer.
source§

impl ToDataKey for ProductValue

source§

impl Value for ProductValue

§

type Type = ProductType

The type of this value.
source§

impl Eq for ProductValue

source§

impl StructuralPartialEq for ProductValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Satn for T
where T: Serialize + ?Sized,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the SATN data format into the formatter f.
source§

fn fmt_psql(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the postgres SATN data format into the formatter f.
source§

fn to_satn(&self) -> String

Formats the value using the SATN data format into the returned String.
source§

fn to_satn_pretty(&self) -> String

Pretty prints the value using the SATN data format into the returned String.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more