What is RUST? 什么是Rust?
Rust is a programming language focused on safety, particularly safe concurrency, supporting functional and imperative-procedural paradigms. Rust is syntactically similar to C++, but it provides memory safety without using garbage collection.
Rust是一种专注于安全性的编程语言,特别是安全并发,支持函数式和强制过程式范式。Rust在语法上类似于C++,但它提供了内存安全,而不使用垃圾收集。
It achieves this through a system of ownership with a set of rules that the compiler checks at compile time. Though it does not prevent all possible bugs, it guarantees memory safety by ensuring that certain kinds of bugs, like buffer overflows or access to uninitialized memory, are caught during compilation
它通过一个所有权系统和一组编译器在编译时检查的规则来实现这一点。虽然它不能防止所有可能的错误,但它通过确保在编译期间捕获某些类型的错误(如缓冲区溢出或对未初始化内存的访问)来保证内存安全
Rust is safe Rust安全
When we talk about program safety, there are three distinct aspects to consider:
当我们谈论程序安全时,有三个不同的方面需要考虑:
type safety, memory safety, and thread safety.
类型安全、内存安全和线程安全。
Regarding type safety, Rust is a statically typed language. Type checking, which verifies and enforces type constraints, happens at compile time, so the types of variables have to be determined at compile time.
关于类型安全,Rust是一种静态类型语言。类型检查,即验证和强制类型约束,发生在编译时,因此必须在编译时确定变量的类型。