pub struct Model {
pub search_order: Option<Vec<Name>>,
pub dominance: Option<Expression>,
pub context: Arc<RwLock<Context<'static>>>,
/* private fields */
}Expand description
An Essence model.
Fields§
§search_order: Option<Vec<Name>>§dominance: Option<Expression>§context: Arc<RwLock<Context<'static>>>Implementations§
Source§impl Model
impl Model
Sourcepub fn new(context: Arc<RwLock<Context<'static>>>) -> Model
pub fn new(context: Arc<RwLock<Context<'static>>>) -> Model
Creates a new top-level model from the given context.
Sourcepub fn new_in_parent_scope(parent: SymbolTablePtr) -> Model
pub fn new_in_parent_scope(parent: SymbolTablePtr) -> Model
Creates a new model whose symbol table has parent as parent scope.
Sourcepub fn symbols_ptr_unchecked(&self) -> &SymbolTablePtr
pub fn symbols_ptr_unchecked(&self) -> &SymbolTablePtr
The symbol table for this model as a pointer.
Sourcepub fn symbols_ptr_unchecked_mut(&mut self) -> &mut SymbolTablePtr
pub fn symbols_ptr_unchecked_mut(&mut self) -> &mut SymbolTablePtr
The symbol table for this model as a mutable pointer.
Sourcepub fn symbols(&self) -> RwLockReadGuard<'_, SymbolTable>
pub fn symbols(&self) -> RwLockReadGuard<'_, SymbolTable>
The symbol table for this model as a reference.
Sourcepub fn symbols_mut(&mut self) -> RwLockWriteGuard<'_, SymbolTable>
pub fn symbols_mut(&mut self) -> RwLockWriteGuard<'_, SymbolTable>
The symbol table for this model as a mutable reference.
Sourcepub fn root(&self) -> &Expression
pub fn root(&self) -> &Expression
The root node of this model.
Sourcepub fn root_mut_unchecked(&mut self) -> &mut Expression
pub fn root_mut_unchecked(&mut self) -> &mut Expression
The root node of this model, as a mutable reference.
The caller is responsible for ensuring that the root node remains an Expression::Root.
Sourcepub fn replace_root(&mut self, new_root: Expression) -> Expression
pub fn replace_root(&mut self, new_root: Expression) -> Expression
Replaces the root node with new_root, returning the old root node.
Sourcepub fn constraints(&self) -> &Vec<Expression>
pub fn constraints(&self) -> &Vec<Expression>
The top-level constraints in this model.
Sourcepub fn constraints_mut(&mut self) -> &mut Vec<Expression>
pub fn constraints_mut(&mut self) -> &mut Vec<Expression>
The top-level constraints in this model as a mutable vector.
Sourcepub fn clauses_mut(&mut self) -> &mut Vec<CnfClause>
pub fn clauses_mut(&mut self) -> &mut Vec<CnfClause>
The cnf clauses in this model as a mutable vector.
Sourcepub fn replace_constraints(
&mut self,
new_constraints: Vec<Expression>,
) -> Vec<Expression>
pub fn replace_constraints( &mut self, new_constraints: Vec<Expression>, ) -> Vec<Expression>
Replaces the top-level constraints with new_constraints, returning the old ones.
Sourcepub fn replace_clauses(&mut self, new_clauses: Vec<CnfClause>) -> Vec<CnfClause>
pub fn replace_clauses(&mut self, new_clauses: Vec<CnfClause>) -> Vec<CnfClause>
Replaces the cnf clauses with new_clauses, returning the old ones.
Sourcepub fn add_constraint(&mut self, constraint: Expression)
pub fn add_constraint(&mut self, constraint: Expression)
Adds a top-level constraint.
Sourcepub fn add_clause(&mut self, clause: CnfClause)
pub fn add_clause(&mut self, clause: CnfClause)
Adds a cnf clause.
Sourcepub fn add_constraints(&mut self, constraints: Vec<Expression>)
pub fn add_constraints(&mut self, constraints: Vec<Expression>)
Adds top-level constraints.
Sourcepub fn add_clauses(&mut self, clauses: Vec<CnfClause>)
pub fn add_clauses(&mut self, clauses: Vec<CnfClause>)
Adds cnf clauses.
Sourcepub fn add_symbol(&mut self, decl: DeclarationPtr) -> Option<()>
pub fn add_symbol(&mut self, decl: DeclarationPtr) -> Option<()>
Adds a new symbol to the symbol table.
Sourcepub fn into_single_expression(self) -> Expression
pub fn into_single_expression(self) -> Expression
Converts the constraints in this model to a single expression suitable for use inside another expression tree.
Sourcepub fn collect_stable_id_mapping(&self) -> HashMap<ObjId, ObjId>
pub fn collect_stable_id_mapping(&self) -> HashMap<ObjId, ObjId>
Collects all ObjId values from the model using uniplate traversal.
Trait Implementations§
Source§impl Biplate<Atom> for Model
impl Biplate<Atom> for Model
Source§fn biplate(&self) -> (Tree<Atom>, Box<dyn Fn(Tree<Atom>) -> Self>)
fn biplate(&self) -> (Tree<Atom>, Box<dyn Fn(Tree<Atom>) -> Self>)
§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 Model
impl Biplate<Comprehension> for Model
Source§fn biplate(
&self,
) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Self>)
fn biplate( &self, ) -> (Tree<Comprehension>, Box<dyn Fn(Tree<Comprehension>) -> Self>)
§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<Expression> for Model
impl Biplate<Expression> for Model
Source§fn biplate(&self) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Self>)
fn biplate(&self) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Self>)
§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<Model> for AbstractComprehension
impl Biplate<Model> for AbstractComprehension
Source§fn biplate(
&self,
) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> AbstractComprehension>)
fn biplate( &self, ) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> AbstractComprehension>)
§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<Model> for ComprehensionLetting
impl Biplate<Model> for ComprehensionLetting
Source§fn biplate(
&self,
) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> ComprehensionLetting>)
fn biplate( &self, ) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> ComprehensionLetting>)
§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<Model> for DomainGenerator
impl Biplate<Model> for DomainGenerator
Source§fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> DomainGenerator>)
fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> DomainGenerator>)
§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<Model> for Expression
impl Biplate<Model> for Expression
Source§fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> Expression>)
fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> 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 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<Model> for ExpressionGenerator
impl Biplate<Model> for ExpressionGenerator
Source§fn biplate(
&self,
) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> ExpressionGenerator>)
fn biplate( &self, ) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> ExpressionGenerator>)
§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<Model> for Generator
impl Biplate<Model> for Generator
Source§fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> Generator>)
fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> Generator>)
§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<Model> for SymbolTable
impl Biplate<Model> for SymbolTable
Source§fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> Self>)
fn biplate(&self) -> (Tree<Model>, Box<dyn Fn(Tree<Model>) -> Self>)
§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<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Model> for SerdeModel
impl From<Model> for SerdeModel
Source§impl Typeable for Model
impl Typeable for Model
fn return_type(&self) -> ReturnType
Source§impl Uniplate for Model
impl Uniplate for Model
Source§fn uniplate(&self) -> (Tree<Self>, Box<dyn Fn(Tree<Self>) -> Self>)
fn uniplate(&self) -> (Tree<Self>, Box<dyn Fn(Tree<Self>) -> Self>)
Uniplate. Read more§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
impl Eq for Model
Auto Trait Implementations§
impl Freeze for Model
impl !RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl !UnwindSafe for Model
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,
§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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more§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>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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