分享

The Rust Programming Language

 quasiceo 2014-01-16
Fork me on GitHub

Rust a safe, concurrent, practical language

Rust is a curly-brace, block-structured expression language. It visually resembles the C language family, but differs significantly in syntactic and semantic details. Its design is oriented toward concerns of “programming in the large”, that is, of creating and maintaining boundaries – both abstract and operational – that preserve large-system integrity, availability and concurrency.

It supports a mixture of imperative procedural, concurrent actor, object-oriented and pure functional styles. Rust also supports generic programming and metaprogramming, in both static and dynamic styles.

A short summary of features

Type systemstatic, nominal, linear, algebraic, locally inferred
Memory safetyno null or dangling pointers, no buffer overflows
Concurrencylightweight tasks with message passing, no shared memory
Genericstype parametrization with type classes
Exception handlingunrecoverable unwinding with task isolation
Memory modeloptional task-local GC, safe pointer types with region analysis
Compilation modelahead-of-time, C/C++ compatible
Licensedual MIT / Apache 2

A very small taste of what it looks like

fn main() {
    let nums = [1, 2];
    let noms = ["Tim", "Eston", "Aaron", "Ben"];
 
    let mut odds = nums.iter().map(|&x| x * 2 - 1);
 
    for num in odds {
        do spawn {
            println!("{:s} says hello from a lightweight thread!", noms[num]);
        }
    }
}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多