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 ...
随机推荐
- 7. A typical stream socket session
http://publibfp.dhe.ibm.com/epubs/pdf/f1a2d400.pdf Read and write data on socket s, using the send() ...
- 为什么要使用 do while(0)?
两点 避免宏定义的花括号对代码的完整性造成影响 可以在指定的代码块中(do{})使用break提前跳出,避免goto.
- C++ Primer Plus读书笔记(二)处理数据
1.格式化输出: 和C语言不太一样,C++格式化输出进制格式如下: 1 int a = 42; 2 int b = 42; 3 int c = 42; 4 5 cout << a < ...
- Linux 中的文件属性
文件属性 d 开头是: 目录文件.l 开头是: 符号链接(指向另一个文件,类似于瘟下的快捷方式).s 开头是: 套接字文件(sock).b 开头是: 块设备文件,二进制文件.c 开头是: 字符设备文 ...
- Python学习【第5篇】:数据类型和变量总结
字符串,数字,列表,元组,字典 可变不可变 1.可变:列表 如: p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1); backgr ...
- LOJ10138
ZJOI 2008 树上的统计 一树上有 n 个节点,编号分别为 1 到 n,每个节点都有一个权值 w.我们将以下面的形式来要求你对这棵树完成一些操作: CHANGE u t :把节点 u 权值改为t ...
- Docker系列(一)Docker概述,核心概念讲解,安装部署
部分内容参考链接: Docker实战总结(非常全面,建议收藏) 一. Docker概述 Docker是一个开源的应用容器引擎(基于Go语言开发),让开发者可以打包他们的应用以及依赖包到一个可移植的容器 ...
- PyQt中ui编译成窗体.py,中文乱码
我在Eric工具下编译的 解决办法: 1.打开 C:\Python27\Lib\site-packages\eric4\i18n,将中文资源包的名称"GB2312."去掉,变成er ...
- WLAN参数释义及优化建议
1.AP覆盖范围或天线角度 1)参数释义 AP覆盖范围或天线角度直接影响到了终端连接到WLAN的信号强度. 2)优化建议 在设备的工程安装过程中,合理选择AP的位置,合理调整AP的覆盖方向或外置天线的 ...
- Maven pom中的 scope 详解
Maven的一个哲学是惯例优于配置(Convention Over Configuration), Maven默认的依赖配置项中,scope的默认值是compile,项目中经常傻傻的分不清,直接默认了 ...