ListComprehension

Struct ListComprehension 

Source
pub struct ListComprehension {
    pub span: SourceSpan,
    pub bindings: Vec<Identifier>,
    pub iterables: Vec<Expr>,
    pub body: Box<ScalarExpr>,
    pub selector: Option<ScalarExpr>,
    pub ty: Option<Type>,
}

Fields§

§span: SourceSpan§bindings: Vec<Identifier>

The names to be bound to each element of their corresponding iterable in iterables

NOTE: There must be the same number of bindings as iterables.

§iterables: Vec<Expr>

The generators for this comprehension.

Each iterable must produce the same number of elements as the others.

NOTE: There must be the same number of iterables as bindings.

§body: Box<ScalarExpr>

The expression which will be evaluated at each step of the comprehension

§selector: Option<ScalarExpr>

An optional filter applied to the generator expression at each iteration, which skips values for which the selector evaluates to zero (false).

When the comprehension is used as a constraint, this field is only valid for use in integrity constraints.

§ty: Option<Type>

The type of the result of this list comprehension, e.g. vector[5]

This is set during semantic analysis

Implementations§

Source§

impl ListComprehension

Source

pub fn new( span: SourceSpan, body: ScalarExpr, context: ComprehensionContext, selector: Option<ScalarExpr>, ) -> Self

Creates a new list comprehension.

Trait Implementations§

Source§

impl Clone for ListComprehension

Source§

fn clone(&self) -> ListComprehension

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 Debug for ListComprehension

Source§

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

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

impl Display for ListComprehension

Source§

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

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

impl From<ListComprehension> for Expr

Source§

fn from(expr: ListComprehension) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ListComprehension

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 Spanned for ListComprehension

Source§

impl Eq for ListComprehension

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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.