Ok, so yesterday I wrote a very small program in Rust that splits up Files for me based on the Beginning of a Line.
(I come from a Dynamics NAV Background and I used this to split up an Export of a Complete Database).
But I am sure I made some mistakes and would like to know what the Rust Community thinks about this:
It took me quite a while to get it to work. I had some C/C++ lessons in School, but I’ve been coding C#, Java and (for the majority of my time) C/AL, so I lost some knowledge about the very low-level-stuff…
Some weird things I did, because it wouldn’t compile otherways:
- I have to create a tmp.txt file, because otherwise by the time new_f gets used, it could not be initiated.
- I have no idea when I have to use “”.to_string() or the &… I probabibly have to go through the Tutorial again for this one.
- Instead of handling the line with invalid utf-8 formatting, I just simply do a unwrap_or("") and replace it with an empty line. This is my biggest concern…
I would be very glad if you guys could just give me some insight on where I should improve and change my code, for it to be cleaner and simpler.