pub struct Env {Show 26 fields
pub type_asts: RefCell<HashMap<String, Rc<TypeEntry>>>,
pub type_memo: RefCell<HashMap<String, RT>>,
pub pattern_visiting: RefCell<Vec<String>>,
pub consts: RefCell<HashMap<String, Rc<ConstEntry>>>,
pub funcs: RefCell<HashMap<String, Rc<FuncEntry>>>,
pub duplicates: RefCell<Vec<String>>,
pub outputs: RefCell<Vec<(String, TypeAst, Rc<Expr>)>>,
pub inputs: RefCell<HashMap<String, (TypeAst, Option<Rc<Expr>>)>>,
pub diags: RefCell<HashMap<String, Rc<DiagDecl>>>,
pub registry: RefCell<Rc<RefCell<Vec<Rc<RefCell<RecInst>>>>>>,
pub roots: RefCell<Rc<RefCell<Vec<(String, Value)>>>>,
pub diagnostics: RefCell<Rc<RefCell<Vec<Diag>>>>,
pub const_eval: RefCell<Option<ConstEval>>,
pub expr_eval: RefCell<Option<ExprEval>>,
pub imports: RefCell<HashMap<String, Export>>,
pub namespaces: RefCell<HashMap<String, (Rc<Env>, Rc<RefCell<HashMap<String, Export>>>)>>,
pub dim_decls: RefCell<HashMap<String, Option<Vec<(String, i32)>>>>,
pub dim_memo: RefCell<HashMap<String, DimVec>>,
pub unit_decls: RefCell<HashMap<String, UnitDecl>>,
pub unit_memo: RefCell<HashMap<String, (String, f64)>>,
pub base_unit_of: RefCell<HashMap<String, String>>,
pub space_diags: RefCell<Vec<Diag>>,
pub type_order: RefCell<Vec<String>>,
pub unit_order: RefCell<Vec<String>>,
pub const_diag_sink: RefCell<Option<Rc<RefCell<Vec<Diag>>>>>,
pub tagger: RefCell<Option<Rc<dyn Fn() -> Option<String>>>>,
/* private fields */
}Fields§
§type_asts: RefCell<HashMap<String, Rc<TypeEntry>>>§type_memo: RefCell<HashMap<String, RT>>§pattern_visiting: RefCell<Vec<String>>§consts: RefCell<HashMap<String, Rc<ConstEntry>>>§funcs: RefCell<HashMap<String, Rc<FuncEntry>>>§duplicates: RefCell<Vec<String>>§outputs: RefCell<Vec<(String, TypeAst, Rc<Expr>)>>§inputs: RefCell<HashMap<String, (TypeAst, Option<Rc<Expr>>)>>§diags: RefCell<HashMap<String, Rc<DiagDecl>>>§registry: RefCell<Rc<RefCell<Vec<Rc<RefCell<RecInst>>>>>>§roots: RefCell<Rc<RefCell<Vec<(String, Value)>>>>§diagnostics: RefCell<Rc<RefCell<Vec<Diag>>>>§const_eval: RefCell<Option<ConstEval>>§expr_eval: RefCell<Option<ExprEval>>§imports: RefCell<HashMap<String, Export>>§namespaces: RefCell<HashMap<String, (Rc<Env>, Rc<RefCell<HashMap<String, Export>>>)>>§dim_decls: RefCell<HashMap<String, Option<Vec<(String, i32)>>>>§dim_memo: RefCell<HashMap<String, DimVec>>§unit_decls: RefCell<HashMap<String, UnitDecl>>§unit_memo: RefCell<HashMap<String, (String, f64)>>§base_unit_of: RefCell<HashMap<String, String>>§space_diags: RefCell<Vec<Diag>>§type_order: RefCell<Vec<String>>declaration order (HashMaps do not keep it; diagnostics follow it)
unit_order: RefCell<Vec<String>>§const_diag_sink: RefCell<Option<Rc<RefCell<Vec<Diag>>>>>installed by the checker: constant-evaluation errors go here instead of the report
tagger: RefCell<Option<Rc<dyn Fn() -> Option<String>>>>installed by the engine: the evaluation step a report is attributed to
Implementations§
Source§impl Env
impl Env
pub fn new() -> Rc<Env>
pub fn load(&self, decls: &[Decl])
pub fn report(&self, d: Diag)
Sourcepub fn diag_set(&self, diags: Vec<Diag>)
pub fn diag_set(&self, diags: Vec<Diag>)
replace every diagnostic (the run entry points sort them, §6.7)
pub fn remove_root(&self, name: &str)
pub fn root_names(&self) -> Vec<String>
pub fn registry_retain(&self, pred: impl FnMut(&Rc<RefCell<RecInst>>) -> bool)
pub fn diagnostics_vec(&self) -> Vec<Diag>
pub fn diag_len(&self) -> usize
pub fn diag_truncate(&self, n: usize)
pub fn root(&self, name: &str) -> Option<Value>
pub fn set_root(&self, name: &str, v: Value)
pub fn root_values(&self) -> Vec<Value>
pub fn registry_push(&self, inst: Rc<RefCell<RecInst>>)
pub fn registry_snapshot(&self) -> Vec<Rc<RefCell<RecInst>>>
pub fn const_num(&self, v: &Value) -> Value
pub fn resolve_dim( &self, name: &str, visiting: &mut Vec<String>, ) -> Result<DimVec, String>
pub fn unit_info(&self, sym: &str) -> Result<(String, f64), String>
Sourcepub fn finalize_unit_space(&self) -> Vec<Diag>
pub fn finalize_unit_space(&self) -> Vec<Diag>
§3.16 unit/dimension-space findings for the checker: the load-time redeclarations plus unresolvable units and duplicate base units
pub fn resolve( self: &Rc<Env>, ast: &TypeAst, name: Option<&str>, ) -> Result<RT, String>
Auto Trait Implementations§
impl !Freeze for Env
impl !RefUnwindSafe for Env
impl !Send for Env
impl !Sync for Env
impl !UnwindSafe for Env
impl Unpin for Env
impl UnsafeUnpin for Env
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
Mutably borrows from an owned value. Read more