pub struct ConstEvaluator { /* private fields */ }Expand description
Const evaluator for metadata() handlers.
Implementations§
Source§impl ConstEvaluator
impl ConstEvaluator
Sourcepub fn with_params(params: HashMap<String, KindedSlot>) -> Self
pub fn with_params(params: HashMap<String, KindedSlot>) -> Self
Create a const evaluator with annotation parameters.
Sourcepub fn add_param(&mut self, name: String, value: KindedSlot)
pub fn add_param(&mut self, name: String, value: KindedSlot)
Add an annotation parameter to the scope.
Sourcepub fn add_param_nb(&mut self, name: String, value: KindedSlot)
pub fn add_param_nb(&mut self, name: String, value: KindedSlot)
Add an annotation parameter to the scope (alias kept for API
compatibility — both forms now take a KindedSlot).
Sourcepub fn eval(&self, _expr: &Expr) -> Result<KindedSlot>
pub fn eval(&self, _expr: &Expr) -> Result<KindedSlot>
Evaluate an expression as a const value.
Phase 1.B: the kind-threaded const evaluator is deferred to Phase 2c. Until then, eval returns a deferred error rather than silently produce wrong values.
Sourcepub fn eval_as_nb(&self, expr: &Expr) -> Result<KindedSlot>
pub fn eval_as_nb(&self, expr: &Expr) -> Result<KindedSlot>
Evaluate an expression as a const KindedSlot (alias kept for
API compatibility with the deleted eval_nb shape).
Trait Implementations§
Source§impl Clone for ConstEvaluator
impl Clone for ConstEvaluator
Source§fn clone(&self) -> ConstEvaluator
fn clone(&self) -> ConstEvaluator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConstEvaluator
impl Debug for ConstEvaluator
Source§impl Default for ConstEvaluator
impl Default for ConstEvaluator
Source§fn default() -> ConstEvaluator
fn default() -> ConstEvaluator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConstEvaluator
impl RefUnwindSafe for ConstEvaluator
impl Send for ConstEvaluator
impl Sync for ConstEvaluator
impl Unpin for ConstEvaluator
impl UnsafeUnpin for ConstEvaluator
impl UnwindSafe for ConstEvaluator
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