Rust learning notes
Rust learning notes
Rust

Version 1.42.0
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

version
$ rustc -V
rustc 1.42.0 (b8cedc004 2020-03-09)
$ rustc --version
rustc 1.42.0 (b8cedc004 2020-03-09)
$ rustc -h
Usage: rustc [OPTIONS] INPUT
Options:
-h, --help Display this message
--cfg SPEC Configure the compilation environment
-L [KIND=]PATH Add a directory to the library search path. The
optional KIND can be one of dependency, crate, native,
framework, or all (the default).
-l [KIND=]NAME Link the generated crate(s) to the specified native
library NAME. The optional KIND can be one of
static, framework, or dylib (the default).
--crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro]
Comma separated list of types of crates
for the compiler to emit
--crate-name NAME
Specify the name of the crate being built
--edition 2015|2018
Specify which edition of the compiler to use when
compiling code.
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
Comma separated list of types of output for the
compiler to emit
--print [crate-name|file-names|sysroot|cfg|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|native-static-libs]
Compiler information to print on stdout
-g Equivalent to -C debuginfo=2
-O Equivalent to -C opt-level=2
-o FILENAME Write output to <filename>
--out-dir DIR Write output to compiler-chosen filename in <dir>
--explain OPT Provide a detailed explanation of an error message
--test Build a test harness
--target TARGET Target triple for which the code is compiled
-W, --warn OPT Set lint warnings
-A, --allow OPT Set lint allowed
-D, --deny OPT Set lint denied
-F, --forbid OPT Set lint forbidden
--cap-lints LEVEL
Set the most restrictive lint level. More restrictive
lints are capped at this level
-C, --codegen OPT[=VALUE]
Set a codegen option
-V, --version Print version info and exit
-v, --verbose Use verbose output
Additional help:
-C help Print codegen options
-W help Print 'lint' options and default settings
--help -v Print the full set of options rustc accepts
Current installation options:
default host triple: x86_64-apple-darwin
default toolchain: stable
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

stable installed - rustc 1.42.0 (b8cedc004 2020-03-09)
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
➜ ~
$ source $HOME/.cargo/env
https://github.com/rust-lang/rust
https://www.rust-lang.org/tools/install
https://github.com/rust-lang/rust/blob/master/src/rustc/rustc.rs
fn main() {
// Pull in jemalloc when enabled.
//
// Note that we're pulling in a static copy of jemalloc which means that to
// pull it in we need to actually reference its symbols for it to get
// linked. The two crates we link to here, std and rustc_driver, are both
// dynamic libraries. That means to pull in jemalloc we need to actually
// reference allocation symbols one way or another (as this file is the only
// object code in the rustc executable).
#[cfg(feature = "jemalloc-sys")]
{
use std::os::raw::{c_int, c_void};
#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
}
rustc_driver::set_sigpipe_handler();
rustc_driver::main()
}
WebAssembly

《Rust 程序设计语言》
https://doc.rust-lang.org/book/
https://www.rust-lang.org/zh-CN/learn

// main.rs
fn main() {
println!("Hello, world!");
}
$ rustc main.rs
$ ./main
Hello, world!

PATH environment variable
https://flutter.dev/docs/get-started/install/macos#update-your-path
$PATH
$ cat $HOME/.bash_profile
$ cat $HOME/.bashrc
$ vim $HOME/.bash_profile
$ vim $HOME/.bashrc
$ cat $HOME/.zshrc
$ vim $HOME/.zshrc
zsh
$ cat .zshrc
$ vim .zshrc
# flutter PATH & zsh
export PATH="$PATH:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin"
$ source $HOME/.zshrc
OK
# version
$ rustc --version
# rustc 1.42.0 (b8cedc004 2020-03-09


refs
https://doc.rust-lang.org/book/
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Rust learning notes的更多相关文章
- rt-thread learning notes
rt-thread learning notes 2018-01-15 > 001 具有相同优先级的线程,每个线程的时间片大小都可以在初始化或创建该线程时指定 rt_thread_t rt_th ...
- Mybatis Learning Notes 1
Mybatis Learning Notes 主要的参考是博客园竹山一叶的Blog,这里记录的是自己补充的内容 实体类属性名和数据库不一致的处理 如果是实体类的结果和真正的数据库的column的名称不 ...
- D3 learning notes
D3 https://d3js.org/ 数据驱动文档显示, 利用 SVG HTML CSS技术. D3.js is a JavaScript library for manipulating doc ...
- Coursera, Machine Learning, notes
Basic theory (i) Supervised learning (parametric/non-parametric algorithms, support vector machine ...
- 【Learning Notes】线性链条件随机场(CRF)原理及实现
1. 概述条件随机场(Conditional Random Field, CRF)是概率图模型(Probabilistic Graphical Model)与区分性分类( Discriminative ...
- SQL Learning Notes
Sams Teach Yourself SQL in 10 Minutes
- go learning notes
1) cgo $go install test.go # command-line-arguments /usr/bin/ld: unrecognized option '--build-id=no ...
- Java learning notes (1):Basic Knowlege points
Basic Knowlege points: 1: it's necessary that there is only one public class in per .java file 2: .j ...
- Python Django Learning Notes..
The first time I came across django was last month.. Since then I was considering it as the better c ...
随机推荐
- Set、Map的区别
应用场景Set用于数据重组,Map用于数据储存Set: (1)成员不能重复(2)只有键值没有键名,类似数组(3)可以遍历,方法有add, delete,hasMap:(1)本质上是健值对的集合,类似集 ...
- 像羽毛一样轻的MVVMLight(一)(MVVM 和 MVVMLight简介)
致敬 在此致敬翁智华大佬,感谢大佬为后辈们写下如此详细的文档,本文将在原文基础上添加些自己的理解,希望这样优秀的文档广为流传. 原文请参考 https://www.cnblogs.com/wzh201 ...
- Jaspersoft Studio报表设计
1 开发工具 1.1 软件名称 名称:TIBCO Jaspersoft Studio 版本:6.0或以上,建议6.2.1 1.2 软件安装 免安装软件包,拷贝即可使用,建议放在D:盘或其 ...
- Node.js躬行记(6)——自制短链系统
短链顾名思义是一种很短的地址,应用广泛,例如页面中有一张二维码图片,包含的是一个原始地址(如下所示),如果二维码中的链接需要修改,那么就得发代码替换掉. 原始地址:https://github.com ...
- python实现文件查找功能,excel写入功能
因为要丛UE文档中过滤关键字来统计解码时间,第一次自己完成了一个自动化统计的小工具,用起来颇有成就感. UE文件的内如如下: 需要丛这份关键字中过滤红色标记的两个关键字,取 一个关键字的最后一位,和取 ...
- linux下的ARP攻击(kali)
这是我的学习总结,刚入坑网络安全,写的不好或者有什么错误的希望大佬们指正 首先了解ARP的作用以及原理: ARP(Address Resolution Protocol,地址解析协议)是一个位于TCP ...
- JavaScript(二)——在 V8 引擎中书写最优代码
概述 一个 JavaScript 引擎就是一个程序或者一个解释程序,它运行 JavaScript 代码.一个 JavaScript 引擎可以用标准解释程序或者即时编译器来实现,即时编译器即以某种形式把 ...
- equals()方法和hashCode()方法
1.equal()方法 2.hasCode()方法 2.1 Object的hashCode() 2.2 hashCode()的作用 3.String中equals()和hashCode()的实现 4. ...
- 深信服edr控制中心漏洞——验证码逻辑错误
验证码逻辑错误 文件:tool/log/l.php的第93行
- Hbase 表的设计原则 ————总结
1.列族的数量及列族的势 建议将HBase列族的数量设置的越少越好.当强,对于两个或两个以上的列族HBase并不能处理的很好.这是由于HBase的Flushing和压缩是基于Region的.当一个列族 ...