Struct Relation

Source
pub struct Relation<'a> {
    pub name: &'a str,
    pub arguments: Option<Arguments<'a>>,
    pub columns: Vec<Value<'a>>,
    pub emit: Option<&'a EmitKind>,
    pub children: Vec<Option<Relation<'a>>>,
}

Fields§

§name: &'a str§arguments: Option<Arguments<'a>>

Arguments to the relation, if any.

  • None means this relation does not take arguments, and the argument section is omitted entirely.
  • Some(args) with both vectors empty means the relation takes arguments, but none are provided; this will print as _ => ....
  • Some(args) with non-empty vectors will print as usual, with positional arguments first, then named arguments, separated by commas.
§columns: Vec<Value<'a>>

The columns emitted by this relation, pre-emit - the ‘direct’ column output.

§emit: Option<&'a EmitKind>

The emit kind, if any. If none, use the columns directly.

§children: Vec<Option<Relation<'a>>>

The input relations.

Implementations§

Source§

impl<'a> Relation<'a>

Source

pub fn emitted(&self) -> usize

Source§

impl<'a> Relation<'a>

Source

pub fn input_refs(&self) -> Vec<Value<'a>>

Create a vector of values that are references to the emitted outputs of this relation. “Emitted” here meaning the outputs of this relation after the emit kind has been applied.

This is useful for relations like Filter and Limit whose direct outputs are primarily those of its children (direct here meaning before the emit has been applied).

Source

pub fn convert_children( refs: Vec<Option<&'a Rel>>, ) -> (Vec<Option<Relation<'a>>>, usize)

Convert a vector of relation references into their structured form.

Returns a list of children (with None for ones missing), and a count of input columns.

Trait Implementations§

Source§

impl<'a> From<&'a AggregateRel> for Relation<'a>

Source§

fn from(rel: &'a AggregateRel) -> Self

Convert an AggregateRel to a Relation for textification.

The conversion follows this logic:

  1. Arguments: Group-by expressions (as Value::Expression)
  2. Columns: All possible outputs in order:
    • First: Group-by field references (Value::Reference)
    • Then: Aggregate function measures (Value::AggregateFunction)
  3. Emit: Uses the relation’s emit mapping to select which outputs to display
  4. Children: The input relation
Source§

impl<'a> From<&'a FetchRel> for Relation<'a>

Source§

fn from(rel: &'a FetchRel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a FilterRel> for Relation<'a>

Source§

fn from(rel: &'a FilterRel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a JoinRel> for Relation<'a>

Source§

fn from(rel: &'a JoinRel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a ProjectRel> for Relation<'a>

Source§

fn from(rel: &'a ProjectRel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a ReadRel> for Relation<'a>

Source§

fn from(rel: &'a ReadRel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Rel> for Relation<'a>

Source§

fn from(rel: &'a Rel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a SortRel> for Relation<'a>

Source§

fn from(rel: &'a SortRel) -> Self

Converts to this type from the input type.
Source§

impl Textify for Relation<'_>

Source§

fn name() -> &'static str

Source§

fn textify<S: Scope, W: Write>(&self, ctx: &S, w: &mut W) -> Result

Auto Trait Implementations§

§

impl<'a> Freeze for Relation<'a>

§

impl<'a> RefUnwindSafe for Relation<'a>

§

impl<'a> Send for Relation<'a>

§

impl<'a> Sync for Relation<'a>

§

impl<'a> Unpin for Relation<'a>

§

impl<'a> UnwindSafe for Relation<'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> 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, 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.