points by Covzire 7 years ago

The frustrating part was concatenation, it was surprisingly annoying to combine a few strings and an int into a single string.

steveklabnik 7 years ago

The fastest and easiest way is to use format!.

  let cat = format!("{}{}{}", s1, s2, n);
  • Covzire 7 years ago

    That doesn't seem too bad (Though it's still no C# with the + operator), I'll check that out next time I'm in the Rust neighborhood. Thanks.

    • steveklabnik 7 years ago

      No problem!

      I personally only tend to use + when there's two or maybe three things at most, in any language, and then switch to an API like this if it exists for more complex things, no matter the language. I find it much easier to read. YMMV.

      (And you can use + in Rust, but you'd have to call .to_string() on the integer first)

  • Hortinstein 7 years ago

    steve, think I sent you an email before and you responded, but just wanted to say again the Rust Book is a work of art. Since I read it and emailed you, I completed a fairly non-trivial Grad School project entirely in rust. I took a lot of the shortcuts, but the rust book was an excellent primer.

    Best intro documentation of any language I have tried to learn recently.

    EDIT for those who havent seen it: https://doc.rust-lang.org/book/