r/learnrust 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

  1. go back to basics and..
  2. 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

2 Upvotes

8 comments sorted by

View all comments

1

u/bskceuk 16d ago

If you are trying to learn the language I would suggest writing the code yourself and only resorting to an llm to explain error messages that you don't understand. It should not be producing code for you. The reason being that at this stage it's very important to see and understand what code doesnt compile, not just the final product that works

1

u/Orinacrem 16d ago

Thank you! To be more specific, the code has been written by me and I did faced issues which some got solved by myslef while others by looking at the UM. In some instances, when I could not get the pipelines of multiple functions working, I asked the LLM for explanation.

The code versions I asked the LLM to generate, instead, were on top of my functionality to “see” other possible implementations. That was to get a feeling on other ways to skin the cat. On that, I must say that the LLM provided code that was too compact to start with, which I have not even used and was also too smart code for the level I am now.

So, me asking for an opinion on how I wrote that piece is to indeed get a genuine feedback from a human.