Rust 跑简单的例子
创始人
2024-03-22 15:45:23
0

 

Rust 一门赋予每个人构建可靠且高效软件能力的语言

安装

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 提示失败

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.htmlcurl performs SSL certificate verification by default, using a "bundle"of Certificate Authority (CA) public keys (CA certs). If the defaultbundle file isn't adequate, you can specify an alternate fileusing the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented inthe bundle, the certificate verification probably failed due to aproblem with the certificate (it might be expired, or the name mightnot match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, usethe -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
rustup: command failed: downloader https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup/dist/x86_64-apple-darwin/rustup-init /var/folders/j_/xj53k3kn3mxb_98p4681ypjh0000gn/T/tmp.NyQVPvg9/rustup-init x86_64-apple-darwin

其他下载安装方式

Other Installation Methods - Rust Forge

 

请下载对应版本进行安装,1.65.0大约是200M

Cargo:Rust 的构建工具和包管理器

您在安装 Rustup 时,也会安装 Rust 构建工具和包管理器的最新稳定版,即 Cargo。Cargo 可以做很多事情:

  • cargo build 可以构建项目
  • cargo run 可以运行项目
  • cargo test 可以测试项目
  • cargo doc 可以为项目构建文档
  • cargo publish 可以将库发布到 crates.io。

要检查您是否安装了 Rust 和 Cargo,可以在终端中运行:

cargo --version

Rust 支持多种编辑器 

VS CODE

SUBLIME TEXT

ATOM

INTELLIJ IDEA

ECLIPSE

VIM

EMACS

GEANY

编写Hello_Rust.js

cargo new hello-rust

这会生成一个名为 hello-rust 的新目录,其中包含以下文件:

hello-rust
|- Cargo.toml
|- src|- main.rs

Cargo.toml 为 Rust 的清单文件。其中包含了项目的元数据和依赖库。

src/main.rs 为编写应用代码的地方。


cargo new 会生成一个新的“Hello, world!”项目!我们可以进入新创建的目录中,执行下面的命令来运行此程序:

cargo run

Hello, world!

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...
有效的括号 一、题目 给定一个只包括 '(',')','{','}'...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
【Ctfer训练计划】——(三... 作者名:Demo不是emo  主页面链接:主页传送门 创作初心ÿ...
带头循环双向链表来咯!!! 前言:继上文,我们了解了结构最简单的一种链表---单链表那么我们今天就来...