Hey all! Read a lot of good things about Rust and I was getting pretty bored and often annoyed with building new FastAPI apps. I’m just getting started, from my research Poem seems to be doing the same thing as FastAPI kinda and I’m using SeaORM for the DB.

So far I’m loving it, Cargo.toml looks a lot like Poetry in Python but in VSCode it magically shows me the latest versions of all dependencies. Debugging is really nice because I can just copy & paste compiler messages into an LLM or Google them. It was a bit of a hassle to get all dependencies to work together and to get the thing to compile at first but now it works and I’m happy.

That being said is there anything else I need to know? I still have a very limited understanding of the whole ownership thing but e.g. I understand the benefits of passing variables instead of copying them so I guess that’s a start?

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    16 days ago

    I would say:

    1. Avoid async if you can. It’s way more difficult and error prone than non-async Rust. Unfortunately a lot of web stuff insists on async.
    2. Don’t be afraid to .clone() stuff to fix lifetime errors. It’s not optimal but consider that in C++ everything is pretty much cloned by default, and nobody ever said C++ was slow.
    3. Use anyhow::Result for error handling. It’s the easiest option.