Comment

Comment by KingOfCoders

<3 Rust

The only thing I find difficult in Rust is lifetimes of e.g. "String"s in data structures, e.g. in Scala I have:

    case class CustomerSale(name:String, item:String)
and because of GC I don't have to think about life times, copying etc. - data gets removed after a request or when nothing is used any longer.

In Rust it is

  struct CustomerSale{
    name: String,
    item: String,
  }
which rarely works that simple. I need to think of the life times of name and item, e.g. when I get them from a database, and I don't want to own it, or if I want to copy them or have &str etc. And in web frameworks in Rust there is no notion of request life times which would make things much easier.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton