• @nivenkos
    link
    62 years ago

    I’d recommend reading The Rust Programming Language official book and Rust By Example.

    Then when you get more time Learn Rust With Entirely Too Many Linked Lists to get used to some of the trickier parts of the borrow checker.

  • Ephera
    link
    32 years ago

    If you place data in a struct, you usually want that to be owned by that struct, so you usually don’t want to store a reference in a struct.

    If you pass data around as parameters, you usually do want to pass those by reference, except for simple data types, i.e. anything that is itself smaller or the same size as a pointer.
    For example, on a 64-bit system pointers have a size of 64 bits, so u8, u16, u32, u64, i8 etc. can all be passed around by value (they’ll automatically get copied).

  • @vi21
    link
    22 years ago

    Even if your program clones some data instead of referring to them, it can be still fast.