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&...
【PdgCntEditor】解... 一、问题背景 大部分的图书对应的PDF,目录中的页码并非PDF中直接索引的页码...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
修复 爱普生 EPSON L4... L4151 L4153 L4156 L4158 L4163 L4165 L4166 L4168 L4...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
ChatGPT 怎么用最新详细... ChatGPT 以其强大的信息整合和对话能力惊艳了全球,在自然语言处理上面表现出了惊人...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...