首页   快速返回

rust特点及安装     所属分类 rust
简洁,没有C++遗留问题
更好的泛型,比C++模板更容易使用
没有gc , 性能高
安全性 ,引入所有权和生命期概念,在编译期就能检查出一部分内存管理错误
强大的静态类型检查
现代语言特性 ,支持多范式



https://www.rust-lang.org/

执行以下命令下载安装
curl https://sh.rustup.rs -sSf | sh

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /Users/dugang/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile files located at:

  /Users/dugang/.profile
  /Users/dugang/.bash_profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-apple-darwin
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2019-04-25, rust version 1.34.1 (fc50f328b 2019-04-24)
info: downloading component 'rustc'
 78.9 MiB /  78.9 MiB (100 %)   4.9 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 51.1 MiB /  51.1 MiB (100 %)   4.8 MiB/s ETA:   0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 10.2 MiB /  10.2 MiB (100 %)   4.7 MiB/s ETA:   0 s
info: installing component 'rustc'
 78.9 MiB /  78.9 MiB (100 %)   8.9 MiB/s ETA:   0 s
info: installing component 'rust-std'
 51.1 MiB /  51.1 MiB (100 %)  10.7 MiB/s ETA:   0 s
info: installing component 'cargo'
info: installing component 'rust-docs'
 10.2 MiB /  10.2 MiB (100 %)   1.1 MiB/s ETA:   0 s
info: default toolchain set to 'stable'

  stable installed - rustc 1.34.1 (fc50f328b 2019-04-24)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH 
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env



下载安装的组件
rustc 
rust-std
cargo
rust-docs

首次使用先执行 
source $HOME/.cargo/env

cat $HOME/.cargo/env
export PATH="$HOME/.cargo/bin:$PATH"

.profile  .bash_profile 里已经自动添加了 path
export PATH="$HOME/.cargo/bin:$PATH"


编译工具 rustc 
包管理工具 cargo

rustup 是 Rust 的一个安装器,用来更新 Rust 编译器,跟 Python 的 virtualenv 有点像,
可以维护不同版本的 Rust 编译器,如 stable, nightly,beta 等



rustc -V
rustc 1.34.1 (fc50f328b 2019-04-24)

上一篇     下一篇
elasticsearch7.0压测问题记录

elasticsearch工具

kafka监控工具kafka-eagle编译安装使用

maven命令行运行main方法

tomcat8.5压测记录

tomcat8.5类加载机制