7.1. Rust tutorial

发布时间 : 2025-10-25 13:33:19 UTC      

Page Views: 9 views

Image0

Rust is an efficient and reliable universal high-level language. Its efficiency is not limited to development efficiency, its execution efficiency is also commendable, and it is a rare language that takes into account both development efficiency and execution efficiency.

The Rust language was developed by Mozilla and was first released in September 2014. Rust’s compiler is free and open source software under the dual agreement declaration of MIT License and Apache License 2.0. The latestcompiler version as of January 2020 is 1.41.0.

Rust official online tool: https://play.rust-lang.org/ .

The contents of Rust series articles are collected and organized by Sobin.

7.1.1. The characteristics of Rust language #

High performance-Rust is amazing and memory utilization is extremely high. Without runtime and garbage collection, it is competent for performance-demanding services, can run on embedded devices, and can easily integrate with other languages.

Reliability-Rust’s rich type system and ownership model ensures memory safety and thread safety, allowing you to eliminate all kinds of errors at compile time.

Productivity-Rust has excellent documentation, friendly compilers, and clearerror messages, integrates best-in-class tools-package managers and build tools, multi-editor support for intelligent automatic completion and type checking, automatic formatting code, and more.

7.1.2. Application of Rust #

The Rust language can be used for development:

  • Traditional command line programs-the Rust compiler can generate target executable programs directly without any interpreter.

  • Web applications-Rust can be compiled into WebAssembly, and WebAssembly is an efficient substitute for JavaScript.

  • Network server-Rust achieves security and efficiency with very low resource consumption, and has strong large-scale concurrent processing ability, so itis very suitable for the development of ordinary or extreme server programs.

  • Embedded device-Rust has the general efficient development syntax of JavaScript and the execution efficiency of C language, and supports the development of the underlying platform.

7.1.3. Who is suitable for this tutorial? #

This tutorial will be familiar with basic programming knowledge by default, so if you read this tutorial, you need to have some knowledge of basic programming knowledge (preferably new knowledge of Cmax programming + or JavaScript programming language).

The first Rust program #

The Rust language code file is suffixed with the name .rs , such as runoob.rs .

Example: runoob.rs file

fn main() { println!("Hello World!"); } 

Use rustc command compilation runoob.rs file:

$ rustc runoob.rs # Compile the runoob.rs file 

Will be generated after compilation runoob executable file:

$ ./runoob # execute runoob Hello World! 

7.1.4. Reference link #

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。