Announcement

Collapse
No announcement yet.

Rust 1.9 Released

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rust 1.9 Released

    Phoronix: Rust 1.9 Released

    Version 1.9 of the Rust programming language is now available...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Support for specializations is pretty good news. There was, for example, three ways of turning a &str into a String:
    1. let string = var.to_string();
    2. let string = var.to_owned();
    3. let string = String::from(var);

    The first is a generic method supported by all types that's not at all optimized. It's the equivalent of running let string = format!("{}", var);. This is useful for converting numbers and structures into strings, but it's redundant to format a string as a string. The second and third options are identical to each other and are optimized because they are simply creating an owned string from a string reference.

    With the new release providing support for specialization, to_string() is now equivalent to to_owned() so programmers don't have to know the difference anymore. Any use of to_string() performed on an &str will automatically be optimized to to_owned() so that there is no performance impact in choosing to_string() instead of to_owned() or String::from().
    Last edited by mmstick; 27 May 2016, 02:04 AM.

    Comment


    • #3
      Originally posted by mmstick View Post
      Support for specializations is pretty good news. There was, for example, three ways of turning a &str into a String:
      1. let string = var.to_string();
      2. let string = var.to_owned();
      3. let string = String::from(var);


      The first is a generic method supported by all types that's not at all optimized. It's the equivalent of running let string = format!("{}", var);. This is useful for converting numbers and structures into strings, but it's redundant to format a string as a string. The second and third options are identical to each other and are optimized because they are simply creating an owned string from a string reference.

      With the new release providing support for specialization, to_string() is now equivalent to to_owned() so programmers don't have to know the difference anymore. Any use of to_string() performed on an &str will automatically be optimized to to_owned().
      I think you may have alienated any readers who do not know Rust already. Then again, who else reads this article …

      Comment


      • #4
        Originally posted by CrystalGamma View Post

        I think you may have alienated any readers who do not know Rust already. Then again, who else reads this article …
        I would imagine that anyone with a rudimentary understanding of systems programming would at least get the gist of the subject, even if they do not know Rust yet. Most programming languages have a format function, such as C's sprintf function. Rust's format!() macro works similarly, only it is both faster and simpler to use. A C programmer would also know the difference between an owned value and a reference, although the concept of vectors is beyond the scope of C.

        Comment


        • #5
          Great. Really hope some real apps be created using Rust, and with some API platform link Gtk-Rust binding of course.

          Comment


          • #6
            Originally posted by goTouch View Post
            Great. Really hope some real apps be created using Rust, and with some API platform link Gtk-Rust binding of course.
            I've already written some GTK3 applications with Rust that are pretty good.
            Systemd Service Manager

            TV Renamer

            Comment

            Working...
            X