RelValue

Enum RelValue 

Source
pub enum RelValue<'a> {
    Row(RowRef<'a>),
    Projection(ProductValue),
    ProjRef(&'a ProductValue),
}
Expand description

RelValue represents either a reference to a row in a table, a reference to an inserted row, or an ephemeral row constructed during query execution.

A RelValue is the type generated/consumed by queries.

Variants§

§

Row(RowRef<'a>)

A reference to a row in a table.

§

Projection(ProductValue)

An ephemeral row made during query execution.

§

ProjRef(&'a ProductValue)

A row coming directly from a collected update.

This is really a row in a table, and not an actual projection. However, for (lifetime) reasons, we cannot (yet) keep it as a RowRef<'_> and must convert that into a ProductValue.

Implementations§

Source§

impl<'a> RelValue<'a>

Source

pub fn into_product_value(self) -> ProductValue

Converts self into a ProductValue either by reading a value from a table, cloning the reference to a ProductValue, or consuming the owned product.

Source

pub fn into_product_value_cow(self) -> Cow<'a, ProductValue>

Converts self into a Cow<'a, ProductValue> either by reading a value from a table, passing the reference to a ProductValue, or consuming the owned product.

Source

pub fn num_columns(&self) -> usize

Computes the number of columns in this value.

Source

pub fn extend(self, other: RelValue<'a>) -> RelValue<'a>

Extends self with the columns in other.

This will always cause RowRef<'_>s to be read out into ProductValues.

Source

pub fn read_column(&self, col: usize) -> Option<Cow<'_, AlgebraicValue>>

Read the column at index col.

Use read_or_take_column instead if you have ownership of self.

Source

pub fn get(&'a self, col: ColExprRef<'a>) -> Cow<'a, AlgebraicValue>

Returns a column either at the index specified in col, or the column is the value that col holds.

Panics if, for ColExprRef::Col(col), the col is out of bounds of self.

Source

pub fn read_or_take_column(&mut self, col: usize) -> Option<AlgebraicValue>

Reads or takes the column at col. Calling this method consumes the column at col for a RelValue::Projection, so it should not be called again for the same input.

Panics if col is out of bounds of self.

Source

pub fn project_owned(self, cols: &[ColExpr]) -> ProductValue

Turns cols into a product where a value in cols is taken directly from it and indices are taken from self.

Panics on an index that is out of bounds of self.

Trait Implementations§

Source§

impl<'a> Clone for RelValue<'a>

Source§

fn clone(&self) -> RelValue<'a>

Returns a duplicate 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<'a> Debug for RelValue<'a>

Source§

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

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

impl<'a> From<Row<'a>> for RelValue<'a>

Source§

fn from(value: Row<'a>) -> Self

Converts to this type from the input type.
Source§

impl Hash for RelValue<'_>

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 PartialEq for RelValue<'_>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Serialize for RelValue<'a>

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 ToBsatn for RelValue<'_>

Source§

fn to_bsatn_vec(&self) -> Result<Vec<u8>, BsatnError>

BSATN-encode the row referred to by self into a freshly-allocated Vec<u8>.
Source§

fn to_bsatn_extend(&self, buf: &mut Vec<u8>) -> Result<(), BsatnError>

BSATN-encode the row referred to by self into buf, pushing self’s bytes onto the end of buf, similar to Vec::extend.
Source§

fn static_bsatn_size(&self) -> Option<u16>

Returns the static size of the type of this object. Read more
Source§

impl Eq for RelValue<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for RelValue<'a>

§

impl<'a> !RefUnwindSafe for RelValue<'a>

§

impl<'a> Send for RelValue<'a>

§

impl<'a> Sync for RelValue<'a>

§

impl<'a> Unpin for RelValue<'a>

§

impl<'a> !UnwindSafe for RelValue<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

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<(), Error>

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

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

Formats the value using the postgres SATN(PsqlFormatter { f }, /* PsqlType */) 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,

Source§

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>,

Source§

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>,

Source§

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.