I have been programming in Rust for about 8 years now. I love the language. But I feel I have some confessions I must make.

  1. I don’t know if I use tabs or spaces in my final code. I just assume that it all get solved correctly by cargo fmt. I don’t even understand that people have been arguing about this for real? I vaguely remember this being important in C and C++, but I am hoping I never go back to those dark days.

  2. I never do linebreaks, not even when adding my semicolons. I hit “:w” and if shit doesn’t move around on my screen, I fucked up somewhere.

  3. The only lifetime I ever use is '_, 'a or 'static otherwise I give up

  4. Wtf is the 'de lifetime in serde deserialize??

  5. Rocket is the best web server

  6. I actively chose software written in Rust over other software, even if it’s not better, and I argue that it is.

Okay, got that of my chest. Never dared telling anyone this before. Feels scary

  • Ephera ( Ephera@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 years ago
    1. Wtf is the 'de lifetime in serde deserialize??

    Aside from 'static (and the anonymous lifetime '_), the exact name isn’t actually meaningful beyond explaining to the reader what you intend to use this lifetime for.

    So, whether you call it 'a or 'de or 'database doesn’t change anything about the lifetime itself.
    Serde calling it the 'de lifetime is just to clarify that this is the lifetime of the deserialized object.

  • TehPers ( TehPers@beehaw.org ) 
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

    For #4: the 'de lifetime is the lifetime of the deserializer (and input data). It’s used to allow you to deserialize the data into a type without copying it, like deserializing a &'a [u8] buffer into a &'a str. It’s documented here if you want to read more.

  • Rogue ( Rogue@feddit.uk ) 
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago
    1. I actively chose software written in Rust over other software, even if it’s not better, and I argue that it is.

    Rust has quite a high barrier for entry which is likely to deter inexperienced developers. I’d say that’s enough justification to favour software written in Rust.

    Python on the other hand is far too easy to get started with, thus the ecosystem is plagued with terrible software. I avoid it like the plague. Yes, there some decent projects written in Python but they are rare things

  • grapemix ( grapemix@lemmy.ml ) 
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    Rust is not just beginner unfriendly, rust is also intermediate lvl unfriendly and very hard to read others’ code.

    But at the same time, I also like it…

      • Bogasse ( Bogasse@lemmy.ml ) 
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        It also has the best learning resources I’ve ever found for a programing language, which are free BTW.

        I’ve tried to found a Python course for a friend (paid or not), and I couldn’t find anything that looked close to the quality of the Rust book. Some paid online courses have to be awesome but they are all paywalled before the first relevant chapter 🤷