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
impl ListComprehension
Sourcepub fn new(
span: SourceSpan,
body: ScalarExpr,
context: ComprehensionContext,
selector: Option<ScalarExpr>,
) -> Self
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
impl Clone for ListComprehension
Source§fn clone(&self) -> ListComprehension
fn clone(&self) -> ListComprehension
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ListComprehension
impl Debug for ListComprehension
Source§impl Display for ListComprehension
impl Display for ListComprehension
Source§impl From<ListComprehension> for Expr
impl From<ListComprehension> for Expr
Source§fn from(expr: ListComprehension) -> Self
fn from(expr: ListComprehension) -> Self
Source§impl PartialEq for ListComprehension
impl PartialEq for ListComprehension
Source§impl Spanned for ListComprehension
impl Spanned for ListComprehension
fn span(&self) -> SourceSpan
impl Eq for ListComprehension
Auto Trait Implementations§
impl Freeze for ListComprehension
impl RefUnwindSafe for ListComprehension
impl Send for ListComprehension
impl Sync for ListComprehension
impl Unpin for ListComprehension
impl UnwindSafe for ListComprehension
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more