Skip to main content

Env

Struct Env 

Source
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

Source

pub fn new() -> Rc<Env>

Source

pub fn load(&self, decls: &[Decl])

Source

pub fn report(&self, d: Diag)

Source

pub fn diag_set(&self, diags: Vec<Diag>)

replace every diagnostic (the run entry points sort them, §6.7)

Source

pub fn remove_root(&self, name: &str)

Source

pub fn root_names(&self) -> Vec<String>

Source

pub fn registry_retain(&self, pred: impl FnMut(&Rc<RefCell<RecInst>>) -> bool)

Source

pub fn diagnostics_vec(&self) -> Vec<Diag>

Source

pub fn diag_len(&self) -> usize

Source

pub fn diag_truncate(&self, n: usize)

Source

pub fn root(&self, name: &str) -> Option<Value>

Source

pub fn set_root(&self, name: &str, v: Value)

Source

pub fn root_values(&self) -> Vec<Value>

Source

pub fn registry_push(&self, inst: Rc<RefCell<RecInst>>)

Source

pub fn registry_snapshot(&self) -> Vec<Rc<RefCell<RecInst>>>

Source

pub fn const_num(&self, v: &Value) -> Value

Source

pub fn resolve_dim( &self, name: &str, visiting: &mut Vec<String>, ) -> Result<DimVec, String>

Source

pub fn unit_info(&self, sym: &str) -> Result<(String, f64), String>

Source

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

Source

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> 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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.