• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Rust 跑的例子

武飞扬头像
KENYCHEN奉孝
帮助1

学新通

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

安装

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

  1.  
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2.  
    info: downloading installer
  3.  
    curl: (60) SSL certificate problem: certificate has expired
  4.  
    More details here: https://curl.haxx.se/docs/sslcerts.html
  5.  
     
  6.  
    curl performs SSL certificate verification by default, using a "bundle"
  7.  
    of Certificate Authority (CA) public keys (CA certs). If the default
  8.  
    bundle file isn't adequate, you can specify an alternate file
  9.  
    using the --cacert option.
  10.  
    If this HTTPS server uses a certificate signed by a CA represented in
  11.  
    the bundle, the certificate verification probably failed due to a
  12.  
    problem with the certificate (it might be expired, or the name might
  13.  
    not match the domain name in the URL).
  14.  
    If you'd like to turn off curl's verification of the certificate, use
  15.  
    the -k (or --insecure) option.
  16.  
    HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
  17.  
    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 的新目录,其中包含以下文件:

  1.  
    hello-rust
  2.  
    |- Cargo.toml
  3.  
    |- src
  4.  
    |- main.rs

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

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


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

cargo run

Hello, world!

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgaeacg
系列文章
更多 icon
同类精品
更多 icon
继续加载