Rust Mozilla 的编程语言

Rust 是 Mozilla 的一个新的编程语言,由 web 语言的领军人物 Brendan Eich(js 之父),Dave Herman 以及 Mozilla 公司的 Graydon Hoare 合力开发。

创建这个新语言的目的是为了解决一个很顽疾的问题:软件的演进速度大大低于硬件的演进,软件在语言级别上无法真正利用多核计算带来的性能提升。Rust 是针对多核体系提出的语言,并且吸收一些其他动态语言的重要特性,比如不需要管理内存,比如不会出现 Null 指针等等。

特点:

  • 零成本的抽象

  • 移动语义

  • 保证内存安全

  • 线程没有数据竞争

  • trait-based 泛型

  • 模式匹配

  • 类型推断

  • 最小运行时

  • 高效的 C 绑定

cpp 复制代码
// This code is editable and runnable!
fn main() {
    // A simple integer calculator:
    // `+` or `-` means add or subtract by 1
    // `*` or `/` means multiply or divide by 2

    let program = "+ + * - /";
    let mut accumulator = 0;

    for token in program.chars() {
        match token {
            '+' => accumulator += 1,
            '-' => accumulator -= 1,
            '*' => accumulator *= 2,
            '/' => accumulator /= 2,
            _ => { /* ignore everything else */ }
        }
    }

    println!("The program \"{}\" calculates the value {}",
              program, accumulator);
}
相关推荐
Csvn8 小时前
Nginx 静态站点与 location 匹配:优先级、alias、缓存头与 gzip
后端·nginx
pps-key8 小时前
网络攻防入门:从“黑客梦”到合法实操(生存篇)
开发语言·web安全·php
小满zs9 小时前
Go语言第二十章(初探Gin)
后端·go
学长毕设9 小时前
基于SpringBoot军事纪念馆管理系统设计与实现-附源码
java·spring boot·后端
小满zs9 小时前
Go语言第十九章(http标准库)
后端·go
汤姆宝库9 小时前
BPE分词器的完整实现:字节对合并与词表构建
开发语言·人工智能·c#
wflynn9 小时前
GitHub 今日推荐|kiri:clone3 系统调用直达容器,2.5 毫秒启动无 runc 中间层
docker·rust·kubernetes·开源·github·containers
驭渊的小故事11 小时前
订单服务如何调用商品服务?一次 RestTemplate 跨服务调用入门
java·开发语言·php
考虑考虑11 小时前
nginx拦截url
运维·后端·nginx
GISer_Jing11 小时前
GitHub热点I
后端·ai·langchain