Pages

Wednesday, 4 November 2015

编程语言-rust

Rust is a fast systems programming language that guarantees memory safety and offers painless concurrency (no data races). It does not employ a garbage collector and has minimal runtime overhead.

This repo contains the code for the compiler (rustc), as well as standard libraries, tools and documentation for Rust.

Quick Start

(运行curl -sf -L https://static.rust-lang.org/rustup.sh | sh 后,显示:
...
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-docs'
install: installing component 'cargo'

    Rust is ready to roll.
root@AR:~#  
这样就生成了可执行文件rustc和cargo)

如果你要安装nightly,则运行/usr/local/lib/rustlib/uninstall.sh卸载旧版,然后运行:
curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
来安装nightly版。建议安装nightly版,nightly版的功能更强大。
from https://www.rust-lang.org/downloads.html
参考:https://crates.io/install ,http://doc.crates.io/guide.html
Rust的包管理器Cargo。

英文:http://doc.crates.io/index.html

中文:http://blog.csdn.net/ucan23/article/details/45667187

Building from Source(不建议从源码进行编译安装!我make 时遇到错误。而用上面的"Installing Rust" 里面的方法却成功安装了rust)

  1. Make sure you have installed the dependencies:
    • g++ 4.7 
    • python 2.6 or later (but not 3.x)
    • GNU make 3.81 or later
    • curl
    • git
    • file
  2. Clone the source with git:
    $ git clone https://github.com/rust-lang/rust.git
    $ cd rust
  3. Build and install:
    $ ./configure
    $ make && make install
    Note: You may need to use sudo make install if you do not normally have permission to modify the destination directory. The install locations can be adjusted by passing a --prefix argument to configure. Various other options are also supported – pass --helpfor more information on them.
    When complete, make install will place several programs into /usr/local/binrustc, the Rust compiler, and rustdoc, the API-documentation tool. This install does not include Cargo, Rust's package manager, which you may also want to build.
    from https://github.com/rust-lang/rust/
    https://github.com/rustcc/rust-zh
    https://www.rust-lang.org
    https://www.rust-lang.org/zh-CN/documentation.html
    相关介绍:
    https://zh.wikipedia.org/wiki/Rust
    http://www.jdon.com/idea/rust.html
    http://mingxinglai.com/cn/2015/03/Intro-to-Rust/
    http://cholerae.com/2015/05/16/译-Go和Rust-两个新型编程语言的未来道路/