Rust在Substrate 开发框架中的使用支持函数式编程 ● 强大友好的编译器 Rust 简介 Rust 的内存安全是由Ownership来保证 ,在编译期间检查,规则: ● 每个值都有一个owner ● 同一时间只有一个owner ● 当owner离开作用域之后,值被丢 弃 Rust 特性 - 内存安全 Rust 特性 - ownership fn print_sum(v: Vec) { println v.push(i); } print_sum(v); println!("Compile error: {}", v); } Rust 特性 - ownership fn print_sum(v: Vec ) { println!("{}", v[0] + v[1]); } fn main() { let mut v = Vec::new(); print_sum(v); println!("Compile error: {}", v); } deallocation create resource move ownership error! Rust 特性 - copy fn print_sum(a: i32, b: i32) { println!("{}", a + b); } fn main() 0 码力 | 37 页 | 967.22 KB | 1 年前3
2021 中国开源年度报告现。 Every developer who has used Linux has suffered from package version conflicts. The NixOS system has gained a vast fan base with its excellent package management tools. One year later, NixOS/nixpkgs 42% Web application development 3 手机/移动开发 Mobile Development 6.89% 4 建站系统 Station System 6.74% 5 应用工具 Application tool 5.6% 6 鸿蒙开源项目 OpenHarmony project 4.68% 新增开源项目领域分布的前五名与 points comprehensively: In the product development phase, the focus is on whether the company has ownership and control of the code and whether it is internationally competitive; in the community operation0 码力 | 199 页 | 9.63 MB | 1 年前3
RustBelt - Rust 的形式化语义模型Background • RustBelt Project • Rust Types Overview Rust Semantics • Type System • The own Predict • Exclusive Ownership & Mutable Borrow Examples • Rc Logics • Hoare Logic • Separation Logic Foundations of the Rust Programming Language Coq Proof Assistant: A Formal Proof Management System built on top of built on top of Rust Types Overview Background T &mut T &T mutable borrow {x = 10} {x = 3} x += 1 {x = 4} {True} loop {} {False} Hoare Logic Logics P: x ↦ v Ownership We own “x”, and “x” points to “v”. Disjointness Given “(x ↦ v) ∗ (y ↦ w)”, we know that “x0 码力 | 21 页 | 2.63 MB | 1 年前3
Rust语言核心竞争力-庄晓立系统编程 Systems Programming 系统编程+零运行时+内存安全 System programming • The programmer will make assumptions about the hardware and other properties of the system that the program runs on, and will often exploit simulated environment can sometimes be used to reduce this problem. https://en.wikipedia.org/wiki/System_programming 系统编程 • 对硬件的控制(嵌入式, OS) • 对系统底层的控制(OS, kernel, driver) • 对CPU和内存的高效利用(Server, OS) • 多 • GC不能管理内存以外的其他资源(file/socket/stream) • 在系统编程领域,GC的运行时开销几乎难以容忍 • GC的终极目的是安全地释放内存 • Rust通过Ownership和RAII也能达到此目的,且性能更好 本次大会涉GC演讲 • Monica Beckwith 《性能工程师指南:玩转OpenJDK HotSpot垃圾收集器》 • 庄振运《OS造成的长时间非典型JVM0 码力 | 51 页 | 1.09 MB | 1 年前3
从零蛋开始学 Rust����� C/C++ ������������ ���������� 1.3.3 ����������� Rust ������������������ Rust � ���(ownership) ��� ���� ������������������������� ���� 1.3.4 Rust ���� Web Assembly (WASM) �� Rust ����� ������������ ������ Rust ��������� usize ��������������������������� cpu ����� ��� Rust ��� Ownership ������������� � stack fn main() { let N: usize = 20; let arr = [0; N]; //��: non-constant ��������������������� C++������������������� �������������������� ���Rust �� Borrowing ��������� ��� � ownership � ��������� �� heap ���������� ��� fn main(){ let v = vec![1,2,3]; // �� v ����������0 码力 | 168 页 | 1.24 MB | 1 年前3
Comprehensive Rust(简体中文) 202412aarch64-paging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 54.3 buddy_system_allocator . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 54.4 tinyvec . . . . . . . 足够长的时间。在安全的 Rust 中不会出现悬空 引用。x_axis 会返回对 point 的引用,但 point 会在该函数返回时取消分配,因此不会进行编 译。 • 我们会在讲到所有权(ownership)时详细讨论借用(borrow)。 9.2 独占引用 独占引用(也称为可变引用)允许更改其所引用的值。它们的类型为&mut T。 fn main() { let mut point = part of the course will cover getting data out of these structures. /// An event in the elevator system that the controller must react to. enum Event { // TODO: add required variants } /// A direction0 码力 | 359 页 | 1.33 MB | 10 月前3
Real world Rust
- Why and how we use Rust in TiKVPingCAP ● CTO of PingCAP ● Codis / TiDB / TiKV ● Go / Python / Rust ... What’s Rust ● Yet another system programming language ○ Maintain by Mozilla ● Stable: 1.13 ○ Stable enough for production use ● Stdlibs Rust 哲学 ● Zero-cost abstraction ● 内存安全 ○ Build-in RAII / Ownership ○ No NULL ptr ● 万物皆有所有权 ○ Ownership system ○ Mutable and immutable reference ● 线程安全 ● 不相信程序员 内存安全 ● 所有权 ● RAII0 码力 | 29 页 | 506.53 KB | 1 年前3
Rust 程序设计语言 简体中文版 1.85.0cargo new,则这些 git 相关文件则不会生成;可以通过运行 cargo new --vcs=git 来覆盖这些行为。 注意:git 是一个常用的版本控制系统(version control system,VCS)。可以通过 --vcs 参数使 cargo new 切换到其它版本控制系统(VCS),或者不使用 VCS。运行 cargo new --help 查看可用的选项。 请自行选用文本编辑器打开 新概念:let、match、函数、使用外部 crate 等等, 接下来的几章,你会继续深入学习这些概念。第三章介绍大部分编程语言都有的概念,比如变 量、数据类型和函数,以及如何在 Rust 中使用它们。第四章探索所有权(ownership),这是 一个 Rust 同其他语言大不相同的特性。第五章讨论结构体和方法的语法,而第六章解释枚举。 37/562Rust 程序设计语言 简体中文版 常见编程概念 本章介绍一些几乎所有编程语言都有的概念,以及它们在 打印圣诞颂歌 “The Twelve Days of Christmas” 的歌词,并利用歌曲中的重复部分(编写循 环)。 当你准备好继续的时候,让我们讨论一个其他语言中并不常见的概念:所有权(ownership)。 66/562Rust 程序设计语言 简体中文版 认识所有权 所有权(系统)是 Rust 最为与众不同的特性,对语言的其他部分有着深刻含义。它让 Rust 无 需垃圾回收(garbage0 码力 | 562 页 | 3.23 MB | 27 天前3
Rust 程序设计语言简体中文版new ,则这些 git 相关文件则不会生成;可以通过运行 cargo new --vcs=git 来覆盖这些行为。 注意:Git 是一个常用的版本控制系统(version control system,VCS)。可以通过 --vcs 参数使 cargo new 切换到其它版本控制系统(VCS),或者不使用 VCS。运行 cargo new --help 参看可用的选项。 请自行选用文本编辑器打开 、函数、使用外部 crate 等等, 接下来的几章,你会继续深入学习这些概念。第三章介绍大部分编程语言都有的概念,比如变 量、数据类型和函数,以及如何在 Rust 中使用它们。第四章探索所有权(ownership),这是 一个 Rust 同其他语言大不相同的功能。第五章讨论结构体和方法的语法,而第六章侧重解释 枚举。 41/600 Rust 程序设计语言 简体中文版 3 . 常 见 的歌词,并利用歌曲中的重复部分(编写循 环)。 当你准备好继续的时候,让我们讨论一个其他语言中 并不 常见的概念:所有权 (ownership)。 70/600 Rust 程序设计语言 简体中文版 4 . 认 识 所 有 权 认识所有权 ch04-00-understanding-ownership.md commit a5e0c5b2c5f9054be3b961aea2c7edfeea591de80 码力 | 600 页 | 12.99 MB | 1 年前3
httpd 2.4.33 中文文档Perl Compatible Regular Expression Library (PCRE) is now included. httpd can be configured to use a system installation of PCRE by passing the --with-pcre flag to configure. Smart Filtering mod_filter introduces mod_authz_owner A new module that authorizes access to files based on the owner of the file on the file system mod_version A new module that allows configuration blocks to be enabled based on the version number all configurations. New Build System The build system has been rewritten from scratch to be based on autoconf and libtool. This makes Apache httpd's configuration system more similar to that of other0 码力 | 2692 页 | 3.12 MB | 1 年前3
共 612 条
- 1
- 2
- 3
- 4
- 5
- 6
- 62













