Login
You're viewing the functional.cafe public feed.
  • Jul 7, 2026, 4:59 PM

    I've been continuing my Rust learning adventure. For my background, I've worked with Springboot and Java for most of my career (or Kotlin, but still Springboot). So I had a lot of conceptual struggle on how to structure my rust application but I think I've settled near a final strategy.

    In Springboot you define beans (services, repositories, whatever they are) using annotations and the framework creates the services and wires up your dependencies via magic. Then when you are writing tests you can create fake dependencies and test things specifically with various modes. Very nice. I like those testing boundaries.

    So here one can see that I'm creating services and wiring their dependencies manually. It isn't that much overhead and compile time will catch invalid stuff instead of runtime like Spring. Really what unlocked this conceptually for me was using reference counting (Rc) and cloning the reference. Now each service "owns" their reference and I'm no longer fighting with borrowing. Services are immutable by design so that is fine.

    So now I have services and repositories and I've split my database records into entities (for lookup purposes later). Is this the "perfect" approach? I don't care. Don't let perfect be the enemy of good. I'd like to ship code someday.

    Also I've been trying out RustRover as an IDE and it is very nice. I've used IntelliJ for years so it isn't too surprising I'd like another product from the same company. Also I can view the database from inside the IDE to spot check stuff.

    Then finally I've setup Forgejo on my home NAS as a git service. So now my code is backed up which is just good practice (I was using git already, just no remotes) Now development is easy on my laptop or desktop and I don't have to worry about hardware failure.

    Okay, that is enough nerding out for now. Back to my day job ;)

    #rustlang #rustrover #programming #coding

    A software design pattern of setting up services when an application starts using reference counting in Rust
    Some Rust code showing a general flow of reading a flat file and parsing records.
    Main method of Rust program showing the high level flow of the application. A window at the bottom of the program shows a database table output.
    💬 0🔄 1⭐ 0