async fn validate_expr(self) -> Result<JsValue, JsValue> {
        let (monaco, editor) = self.editor.borrow().as_ref().unwrap().clone();
        let expr = editor.get_value();
        self.props.on_validate.emit(true);
        let model = editor.get_model();
        let (msg, arr) = match self.props.session.validate_expr(expr).await? {
            None => (true, js_sys::Array::new()),
            Some(err) => {
                let marker = error_to_marker(err);
                let args = JsValue::from_serde(&marker).unwrap();
                let arr = [args].iter().collect::<js_sys::Array>();
                (false, arr)
            }
        };

        monaco.set_model_markers(&model, "exprtk", &arr);
        self.link.send_message(ExpressionEditorMsg::EnableSave(msg));
        Ok(JsValue::UNDEFINED)
    }
/// Validate the editor's current value, and toggle the Save button state
/// if the expression is valid.
Validate the editor's current value, and toggle the Save button state
if the expression is valid.
Validate the editor ' s current value and toggle the Save button state if the expression is valid .
async fn validate_expr(self) -> Result<JsValue, JsValue> {
        let (monaco, editor) = self.editor.borrow().as_ref().unwrap().clone();
        let expr = editor.get_value();
        self.props.on_validate.emit(true);
        let model = editor.get_model();
        let (msg, arr) = match self.props.session.validate_expr(expr).await? {
            None => (true, js_sys::Array::new()),
            Some(err) => {
                let marker = error_to_marker(err);
                let args = JsValue::from_serde(&marker).unwrap();
                let arr = [args].iter().collect::<js_sys::Array>();
                (false, arr)
            }
        };
        monaco.set_model_markers(&model, "exprtk", &arr);
        self.link.send_message(ExpressionEditorMsg::EnableSave(msg));
        Ok(JsValue::UNDEFINED)
    }
async fn validate_expr ( self ) -> Result < JsValue , JsValue > { let ( monaco , editor ) = self . editor . borrow ( ) . as_ref ( ) . unwrap ( ) . clone ( ) ; let expr = editor . get_value ( ) ; self . props . on_validate . emit ( true ) ; let model = editor . get_model ( ) ; let ( msg , arr ) = match self . props . session . validate_expr ( expr ) . await ? { None => ( true , js_sys :: Array :: new ( ) ) , Some ( err ) => { let marker = error_to_marker ( err ) ; let args = JsValue :: from_serde ( & marker ) . unwrap ( ) ; let arr = [ args ] . iter ( ) . collect :: < js_sys :: Array > ( ) ; ( false , arr ) } } ; monaco . set_model_markers ( & model , " " , & arr ) ; self . link . send_message ( ExpressionEditorMsg :: EnableSave ( msg ) ) ; Ok ( JsValue :: UNDEFINED ) }
Validate the editor's current value, and toggle the Save button state
if the expression is valid.
Validate the editor ' s current value and toggle the Save button state if the expression is valid .
self
self