4 ms·
Consider a function like getElementById(). This is natural in JS, but a crisis in Rust - what does it return? How do you ensure that your caller doesn't have so
by millstone 6y ago
Consider a function like getElementById(). This is natural in JS, but a crisis in Rust - what does it return? How do you ensure that your caller doesn't have some unwrapped RefCell on the stack? etc.
Broadly speaking, Rust is good at trees and bad at graphs. This implies real tradeoffs, real design decisions. There are many software components that Rust is just not good at, by design.
- palmtree3000 6y agoApparently [1] it returns Option<Element>. [1] https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Document.html#method.get_element_by_id https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.D...
- k__ 6y agoYes, I didn't understand the problem here neither.