pub struct HandlersMut<'config, MathField>(/* private fields */)
where
MathField: IntoInner;
Implementations§
Source§impl<'config> HandlersMut<'config, MathField>
impl<'config> HandlersMut<'config, MathField>
Sourcepub fn on_edit_field(&mut self, callback: impl FnMut() + 'static)
pub fn on_edit_field(&mut self, callback: impl FnMut() + 'static)
Examples found in repository?
examples/field.rs (lines 14-18)
7fn main() {
8 // getting this is usually the responsibility of
9 // a web framework, e.g. leptos
10 let element: web_sys::HtmlElement = todo!();
11 let mq = MathQuill::get_global_interface();
12
13 let mut config = Config::default();
14 config.handlers().on_edit_field(|| {
15 let field: Option<MathField> = MathQuill::get_global_interface().get_field(&element);
16 let latex = field.unwrap().latex();
17 check_answer(latex);
18 });
19
20 let _field = mq.mount_field(&element, &config);
21
22 // dropping config invalidates closures,
23 // read docs on Config
24}
Auto Trait Implementations§
impl<'config, MathField> Freeze for HandlersMut<'config, MathField>
impl<'config, MathField> !RefUnwindSafe for HandlersMut<'config, MathField>
impl<'config, MathField> !Send for HandlersMut<'config, MathField>
impl<'config, MathField> !Sync for HandlersMut<'config, MathField>
impl<'config, MathField> Unpin for HandlersMut<'config, MathField>
impl<'config, MathField> !UnwindSafe for HandlersMut<'config, MathField>
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