Rust 1.26 Adds Existential Types
Rust 1.26 Adds Existential Types
Written by Kay Ewbank   
Wednesday, 16 May 2018

There's a new version of Rust with support for existential types via impl-trait; better performance and support for 128-bit integers. The new release also has better match bindings and support for slice patterns.

rust Rust was originally sponsored by Mozilla, and is designed to be safe, fast and concurrent without having a garbage collector. It uses innovative means to make system programming safe by the language being constructed in such a way that problems can be detected at compile time. Intended uses include embedding in other languages, writing programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems.

The improvements to the performance of Rust 1.26 start from a discovery that deeply nesting types was non-linear in some cases, for which a fix was implemented. The developers report up to a 12 percent reduction in compile times from this change, along with many other smaller fixes that have improved the compiler performance.

The impl-trait feature is one that many developers have asked for. It lets you create type signatures that don't specify the return type of a function, just that it implements a particular trait. This differs from a trait object by enabling you to have abstract types in returns or in function parameters.This is useful in closures, as it means you can write code like this that avoids boxing and dynamic dispatch:

// before
fn foo() -> Box<Fn(i32) -> i32> {
    Box::new(|x| x + 1)
}
// after
fn foo() -> impl Fn(i32) -> i32 {
    |x| x + 1
}

The inclusive range syntax is now stable, meaning you can write code such as for x in 0..=10.

Basic slice patterns have also been added. These let you match on slices similar to how you match on other data types.

The final change worth noting is a complete re-write of the book, “The Rust Programming Language.” The developers say they've learned a lot about how people learn Rust since the first book was written, and this version is an improvement in every way.

rust 

More Information

Rust Website

Related Articles

Rust 1.24 Adds Reformatter

Rust 1.23 Uses Less Memory

Rust 1.20 Adds Associated Contents

Rust 1.16

Updated Rust Improves Documentation

Rust 1.6 Released

Rust 1.3 Released

Rust Releases New Versions

Rust Hits Stable 1.0 - So What?

Rust 1.0 Alpha Released       

Rust Reaches 0.9

Rust 0.7 Released

Rust 0.4 Full Integration of Borrowed Pointers

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin.

Banner


JetPack And Android Studio 3.2 - Not Much New
09/05/2018

Google I/O used to be an exciting meet up where really new and startling things were announced. Now it's past its best and Googler's have to work hard to package the dull into something that looks exc [ ... ]



Try Amazon GameOn For Free
04/05/2018

Amazon has extended the free introductory period for GameOn, its cross-platform, competitive gaming service, built on the AWS cloud infrastructure, that allows developers to create competitions w [ ... ]


More News

justjsquare

 



 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 16 May 2018 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2018 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.