4 ms·
Which UI code specifically are you referring to and why would the borrow checker prevent you from factoring it out?
by kangalioo 3y ago
Which UI code specifically are you referring to and why would the borrow checker prevent you from factoring it out?
- bsder 3y agoWell, I think the one that stuck out was here: https://github.com/SixArm/rust-guideposts/blob/main/projects/crates/gtk4/hello_world/src/main.rs https://github.com/SixArm/rust-guideposts/blob/main/projects... But here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/text_viewer/main.rs https://github.com/gtk-rs/gtk4-rs/blob/master/examples/text_... and here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/clock/main.rs https://github.com/gtk-rs/gtk4-rs/blob/master/examples/clock... The moment some poor slob of a beginner tries to refactor any of those closures into a "normal" function, they're going to get beat over the head by the borrow checker. Yes, I know why they're required in Rust. And it makes sense once you know Rust well. But a beginner isn't likely to understand why they can't refactor a closure into a function in Rust without a whole lot of clone(). Coding "examples" for Rust need to stop using that closure style--especially in "beginner" code.