3 ms·
I recently ported some Python to Rust and I actually did feel like a lot of the Rust code was pretty similar to Python. Mutating things is mostly not that diff
by ZephyrBlu 4y ago
I recently ported some Python to Rust and I actually did feel like a lot of the Rust code was pretty similar to Python.
Mutating things is mostly not that difficult, just add mut to the declaration and then &mut if you pass it around.
The most difficult thing was lifetimes.
E: borrows got a little tricky as well
- carlmr 4y agoThis is what I mean, I ported some Python code almost 1:1. If you program in a functional way anyway, i.e. having data go through a series of filters, it is quite easy. But not all ways of programming are so easy to port to Rust.