#[non_exhaustive]pub struct Comprehension {
pub return_expression: Expression,
pub qualifiers: Vec<ComprehensionQualifier>,
pub skip_operator: Option<ACOperatorKind>,
/* private fields */
}Expand description
A comprehension.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.return_expression: Expression§qualifiers: Vec<ComprehensionQualifier>§skip_operator: Option<ACOperatorKind>When this comprehension appears inside an AC operator, records which operator so expansion can apply the correct skip semantics for symbolic guards.
Implementations§
Source§impl Comprehension
impl Comprehension
pub fn domain_of(&self) -> Option<Moo<Domain>>
pub fn return_expression(self) -> Expression
pub fn replace_return_expression(&mut self, new_expr: Expression)
pub fn symbols(&self) -> RwLockReadGuard<'_, RawRwLock, SymbolTable>
pub fn quantified_vars(&self) -> Vec<Name>
pub fn generator_conditions(&self) -> Vec<Expression>
Sourcepub fn to_generator_model(&self) -> Model
pub fn to_generator_model(&self) -> Model
Builds a temporary model containing generator qualifiers and guards.
Sourcepub fn to_return_expression_model(&self) -> Model
pub fn to_return_expression_model(&self) -> Model
Builds a temporary model containing the return expression only.
Sourcepub fn add_quantified_guard(&mut self, guard: Expression) -> bool
pub fn add_quantified_guard(&mut self, guard: Expression) -> bool
Adds a guard to the comprehension.
Returns false if the guard references non-quantified decision variables.
Sourcepub fn is_quantified_guard(&self, expr: &Expression) -> bool
pub fn is_quantified_guard(&self, expr: &Expression) -> bool
True iff expr does not reference non-quantified decision variables.
Trait Implementations§
Source§impl Biplate<Comprehension> for Comprehension
impl Biplate<Comprehension> for Comprehension
Source§fn biplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Comprehension>)
fn biplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Comprehension>)
Source§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read moreSource§fn try_replace_child_at_bi(
&mut self,
index: usize,
child: Comprehension,
) -> bool
fn try_replace_child_at_bi( &mut self, index: usize, child: Comprehension, ) -> bool
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<Comprehension> for Expression
impl Biplate<Comprehension> for Expression
Source§fn biplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Expression>)
fn biplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Expression>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<Comprehension> for Model
impl Biplate<Comprehension> for Model
Source§fn biplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Model>)
fn biplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Model>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<Comprehension> for SymbolTable
impl Biplate<Comprehension> for SymbolTable
Source§fn biplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> SymbolTable>)
fn biplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> SymbolTable>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<Expression> for Comprehension
impl Biplate<Expression> for Comprehension
Source§fn biplate(
&self,
) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Comprehension>)
fn biplate( &self, ) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Comprehension>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<SymbolTable> for Comprehension
impl Biplate<SymbolTable> for Comprehension
Source§fn biplate(
&self,
) -> (Tree<SymbolTable>, Box<dyn Fn(Tree<SymbolTable>) -> Comprehension>)
fn biplate( &self, ) -> (Tree<SymbolTable>, Box<dyn Fn(Tree<SymbolTable>) -> Comprehension>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Biplate<SymbolTablePtr> for Comprehension
impl Biplate<SymbolTablePtr> for Comprehension
Source§fn biplate(
&self,
) -> (Tree<SymbolTablePtr>, Box<dyn Fn(Tree<SymbolTablePtr>) -> Comprehension>)
fn biplate( &self, ) -> (Tree<SymbolTablePtr>, Box<dyn Fn(Tree<SymbolTablePtr>) -> Comprehension>)
§fn with_children_bi(&self, children: VecDeque<To>) -> Self
fn with_children_bi(&self, children: VecDeque<To>) -> Self
§fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
fn descend_bi(&self, op: &impl Fn(To) -> To) -> Self
Uniplate::descend] Read more§fn universe_bi(&self) -> VecDeque<To>
fn universe_bi(&self) -> VecDeque<To>
§fn children_bi(&self) -> VecDeque<To>
fn children_bi(&self) -> VecDeque<To>
§fn children_bi_count(&self) -> usize
fn children_bi_count(&self) -> usize
children_bi. Read more§fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
fn try_replace_child_at_bi(&mut self, index: usize, child: To) -> bool
§fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
fn transform_bi(&self, op: &impl Fn(To) -> To) -> Self
§fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn holes_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
§fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
fn contexts_bi(&self) -> impl Iterator<Item = (To, impl Fn(To))>
Source§impl Clone for Comprehension
impl Clone for Comprehension
Source§fn clone(&self) -> Comprehension
fn clone(&self) -> Comprehension
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Comprehension
impl Debug for Comprehension
Source§impl<'de> Deserialize<'de> for Comprehension
impl<'de> Deserialize<'de> for Comprehension
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Comprehension, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Comprehension, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for Comprehension
impl Display for Comprehension
impl Eq for Comprehension
Source§impl Hash for Comprehension
impl Hash for Comprehension
Source§impl PartialEq for Comprehension
impl PartialEq for Comprehension
Source§impl Serialize for Comprehension
impl Serialize for Comprehension
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Comprehension
Source§impl Typeable for Comprehension
impl Typeable for Comprehension
Source§fn return_type(&self) -> ReturnType
fn return_type(&self) -> ReturnType
A comprehension is a collection, so its type is a matrix of the return expression’s type.
This agrees with Comprehension::domain_of, which reports a matrix domain. Reporting the
element type here instead made every “is this a collection?” test quietly miss
comprehensions.
Source§impl Uniplate for Comprehension
impl Uniplate for Comprehension
Source§fn uniplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Comprehension>)
fn uniplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Comprehension>)
Uniplate. Read moreSource§fn try_replace_child_at(&mut self, index: usize, child: Comprehension) -> bool
fn try_replace_child_at(&mut self, index: usize, child: Comprehension) -> bool
§fn descend(&self, op: &impl Fn(Self) -> Self) -> Self
fn descend(&self, op: &impl Fn(Self) -> Self) -> Self
§fn universe(&self) -> VecDeque<Self>
fn universe(&self) -> VecDeque<Self>
§fn with_children(&self, children: VecDeque<Self>) -> Self
fn with_children(&self, children: VecDeque<Self>) -> Self
§fn transform(&self, f: &impl Fn(Self) -> Self) -> Self
fn transform(&self, f: &impl Fn(Self) -> Self) -> Self
§fn rewrite(&self, f: &impl Fn(Self) -> Option<Self>) -> Self
fn rewrite(&self, f: &impl Fn(Self) -> Option<Self>) -> Self
§fn cata<T>(&self, op: &impl Fn(Self, VecDeque<T>) -> T) -> T
fn cata<T>(&self, op: &impl Fn(Self, VecDeque<T>) -> T) -> T
Auto Trait Implementations§
impl !Freeze for Comprehension
impl !RefUnwindSafe for Comprehension
impl !UnwindSafe for Comprehension
impl Send for Comprehension
impl Sync for Comprehension
impl Unpin for Comprehension
impl UnsafeUnpin for Comprehension
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 184 bytes