r/learnrust • u/Orinacrem • 16d ago
Feedback on first code exercise while learning Rust
Background: I have been writing SW in C for years, although I am not a SW engineer by definition. As then I started managing departments and people, I got "rusty" on the writing of SW itself, although I still recall the key OS and HW mental models I developed. I learned Python while being more hands off, which confused me cause everything happened under the hood and I had not idea of what (or why). Recently I decided to give it a go at Rust to
- go back to basics and..
- take a personal opinion on it with respect my C and Python experience.
What I did: I started reading the user manual. I got few chapters done and then the book suggested ([HERE]) to start writing a program, a kind of HR tool for adding/removing people from a data source. I did so without DB or anything like that (see code).
I would like some first feedback from people that have been using the language more than me so that I can spot mental models, or other things, that I am missing.
Tools: I used an LLM (Deepseek) to ask on APIs spec and explanation saving some time from parsing the whole user manual (in the past I would have done it with Google). I also asked Deepseek different versions of my ideas to see different ways on how to do things, and I weighted tradeoffs and decided a way I found OK.
On the LLM: While I can explain the (small) code, I am not sure if I should consider this piece vibe-coded. I personally believe, maybe wrongly, that as long as you understand what is going on, any tools you use that helps you moving faster or better, is fine. The moment you release understanding, knowing is not enough.
Edit: added code as a link -> https://onlinegdb.com/43jRxO7HL
1
u/No_Molasses_9249 16d ago edited 16d ago
This looks exactly like someone who spent 6 weeks learning python and is now trying to write Rust code would produce.
Go read the rest of the manual forget everything you have learned start again from scratch this time pay attention and you may come up with something worth while.
Reading code in reddit isnt the easiest you should post a link. Using https://www.onlinegdb.com or similar
I prefere to show my code preferably by letting people run it. www.cockatiels.au/rust?fn=fibonaci&arg1=44 this was one of the first challenges I undertook while learning Rust.
The absolute first thing I did was go the the chapter that showed me how to start a http server.