pub struct Config<MathField>(/* private fields */)
where
MathField: IntoInner;
Expand description
Read docs on mathquill_js_sys::Config about manual memory management
Implementations§
Source§impl<T> Config<T>where
T: IntoInner,
impl<T> Config<T>where
T: IntoInner,
Sourcepub fn handlers(&mut self) -> HandlersMut<'_, T>
pub fn handlers(&mut self) -> HandlersMut<'_, T>
Examples found in repository?
examples/field.rs (line 14)
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}
Trait Implementations§
Auto Trait Implementations§
impl<MathField> Freeze for Config<MathField>
impl<MathField> !RefUnwindSafe for Config<MathField>
impl<MathField> !Send for Config<MathField>
impl<MathField> !Sync for Config<MathField>
impl<MathField> Unpin for Config<MathField>
impl<MathField> !UnwindSafe for 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