The rules behing Rust functions
blog.cuongle.devTo the author of this blog post: please write the code examples as syntax-colored text, and definitely not as images. I'd love to copy the code and paste it into the Rust playground or godbolt, so I can see exactly what the compiler does and how the code behaves. I can't do that with screenshots of code.
Hi, author here.
I didn't know my post was submitted here. So sorry for the late answer.
The problem with code on substack is that they don't have syntax highlight which make reading the code a pain :( Let me see how to improve it in the next posts.
Thank you for reading!
You can on Apple’s OSs, and some googling suggests you can do it on windows too if you save the image and open in the image viewer. Therefore I’d be surprised if you couldn’t get it working on various linux distros too...
You have to understand how ridiculous this answer sounds.
This is a technical forum. There is an expectation of how things are shared. Images and relying on built in OCR is not anywhere in line with that expectation.
Still it would be nice if the author used the right format for the job.
Would be interesting to see a comparison with GCC's C closures[1].
[1] https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
You'd never have written "behing" if your keyboard's firmware, all the drivers, OS and the GUI and input control were written in Rust!