pub struct ExprOptions {
pub op: IndexMap<String, Option<OpDef>>,
pub evaluate: Option<Evaluate>,
}Expand description
Options for the plugin.
op is an insertion-ordered map, and the order matters: two operators
claiming the same source string resolve to the same token, and the
later entry wins, exactly as it does in the canonical TypeScript. A
None entry deletes an operator the defaults provide.
Fields§
§op: IndexMap<String, Option<OpDef>>§evaluate: Option<Evaluate>Implementations§
Source§impl ExprOptions
impl ExprOptions
Sourcepub fn with_op(self, name: impl Into<String>, def: OpDef) -> Self
pub fn with_op(self, name: impl Into<String>, def: OpDef) -> Self
Add or replace one operator definition.
Sourcepub fn without_op(self, name: impl Into<String>) -> Self
pub fn without_op(self, name: impl Into<String>) -> Self
Delete a default operator, the Rust spelling of plain: null.
Sourcepub fn with_evaluate(
self,
evaluate: impl Fn(&mut EvalSite<'_>, &Op, &[Value]) -> Value + Send + Sync + 'static,
) -> Self
pub fn with_evaluate( self, evaluate: impl Fn(&mut EvalSite<'_>, &Op, &[Value]) -> Value + Send + Sync + 'static, ) -> Self
Set the evaluator that reduces each expression as it closes.
Sourcepub fn from_value(options: &Value) -> Self
pub fn from_value(options: &Value) -> Self
Read the operator table out of a serialized option bag, as the engine hands it to a plugin. Unreadable entries are ignored, the way the canonical plugin ignores what it cannot use.
Trait Implementations§
Source§impl Clone for ExprOptions
impl Clone for ExprOptions
Source§impl Debug for ExprOptions
impl Debug for ExprOptions
Auto Trait Implementations§
impl !RefUnwindSafe for ExprOptions
impl !UnwindSafe for ExprOptions
impl Freeze for ExprOptions
impl Send for ExprOptions
impl Sync for ExprOptions
impl Unpin for ExprOptions
impl UnsafeUnpin for ExprOptions
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