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的更多相关文章

  1. rt-thread learning notes

    rt-thread learning notes 2018-01-15 > 001 具有相同优先级的线程,每个线程的时间片大小都可以在初始化或创建该线程时指定 rt_thread_t rt_th ...

  2. Mybatis Learning Notes 1

    Mybatis Learning Notes 主要的参考是博客园竹山一叶的Blog,这里记录的是自己补充的内容 实体类属性名和数据库不一致的处理 如果是实体类的结果和真正的数据库的column的名称不 ...

  3. D3 learning notes

    D3 https://d3js.org/ 数据驱动文档显示, 利用 SVG HTML CSS技术. D3.js is a JavaScript library for manipulating doc ...

  4. Coursera, Machine Learning, notes

      Basic theory (i) Supervised learning (parametric/non-parametric algorithms, support vector machine ...

  5. 【Learning Notes】线性链条件随机场(CRF)原理及实现

    1. 概述条件随机场(Conditional Random Field, CRF)是概率图模型(Probabilistic Graphical Model)与区分性分类( Discriminative ...

  6. SQL Learning Notes

    Sams Teach Yourself SQL in 10 Minutes

  7. go learning notes

    1)  cgo $go install test.go # command-line-arguments /usr/bin/ld: unrecognized option '--build-id=no ...

  8. 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 ...

  9. Python Django Learning Notes..

    The first time I came across django was last month.. Since then I was considering it as the better c ...

随机推荐

  1. 小鹏汽车技术中台实践 :微服务篇 InfoQ 今天 以下文章来源于InfoQ Pro

    小鹏汽车技术中台实践 :微服务篇 InfoQ  今天 以下文章来源于InfoQ Pro

  2. 洛谷P3501

    Description 对于一个 \(0/1\) 串,如果取反后再将整个串反过来和原串一样,就称作「反对称」字符串 给出一个长度为 \(n\) 的 \(0/1\) 串,求它有多少个反对称子串 Solu ...

  3. Eureka详解系列(四)--Eureka Client部分的源码和配置

    简介 按照原定的计划,我将分三个部分来分析 Eureka 的源码: Eureka 的配置体系(已经写完,见Eureka详解系列(三)--探索Eureka强大的配置体系): Eureka Client ...

  4. Codeforces Round #656 (Div. 3) B. Restore the Permutation by Merger

    题目链接:https://codeforces.com/contest/1385/problem/B 题意 有两个大小为 $n$ 的相同的排列,每次从二者或二者之一的首部取元素排入新的数组,给出这个大 ...

  5. 阅读笔记:ImageNet Classification with Deep Convolutional Neural Networks

    概要: 本文中的Alexnet神经网络在LSVRC-2010图像分类比赛中得到了第一名和第五名,将120万高分辨率的图像分到1000不同的类别中,分类结果比以往的神经网络的分类都要好.为了训练更快,使 ...

  6. Codeforces Global Round 9 E. Inversion SwapSort

    题目链接:https://codeforces.com/contest/1375/problem/E 题意 给出一个大小为 $n$ 的数组 $a$,对数组中的所有逆序对进行排序,要求按照排序后的顺序交 ...

  7. Educational Codeforces Round 85 (Div. 2)

    题目链接:https://codeforces.com/contest/1334 A. Level Statistics 题意 一个关卡有玩家的尝试次数和通关次数,按时间顺序给出一个玩家 $n$ 个时 ...

  8. C#Assembly、程序集、装配件、命名空间以及类型的关系

    Assembly = 程序集 = 装配件 命名空间是类的逻辑组织形式,程序集是类的物理组织形式. 程序集其实和命名空间没有什么必然的联系. 程序集1: namespace1{ public class ...

  9. 使用 Tye 辅助开发 k8s 应用竟如此简单(二)

    续上篇,这篇我们来进一步探索 Tye 更多的使用方法.本篇我们来了解一下如何在 Tye 中使用服务发现. Newbe.Claptrap 是一个用于轻松应对并发问题的分布式开发框架.如果您是首次阅读本系 ...

  10. 数据库之postgreSQL入门操作指南

    一.增 二.删 三.改 四.查 五.SQL操作表 1.增加列 ALTER TABLE table_name ADD column_name datatype; 2.删除一列 ALTER TABLE t ...