当前位置:首页 > CN2资讯 > 正文内容

rustdesk 自建服务器 windows rust怎么自建服务器

11小时前CN2资讯


一、资源准备

1.1 Rust安装器下载

  • 官网地址:Rust 程序设计语言 (rust-lang.org)
  • 下载文件:rustup-init.exe(别急着运行)

1.2 汉化学习文档

  • 学习文档地址: Rust 程序设计语言 - Rust 程序设计语言 中文版 (rustwiki.org.cn)

二、安装准备

  • 注意:以下环境变量的配置是为了修改rustup-init.exe安装时的默认路径,默认路径是 C:\User\用户名\.rustup 和 C:\Users\用户名\.cargo,添加以上环境变量后默认路径修改为 C:\WorkSpace\Rust_environment\.rustup 和 C:\WorkSpace\Rust_environment\.cargo,读者可根据自己的电脑目录及存储自定义这两个地址。
  • 在环境变量-用户变量中添加:
  • 变量名:CARGO_HOME 变量值:C:\WorkSpace\Rust_environment\.cargo
  • 在环境变量-用户变量中添加:
  • 变量名:RUSTUP_HOME 变量值:C:\WorkSpace\Rust_environment\.rustup
  • 在在环境变量-用户变量-path中添加:
  • %CARGO_HOME%
  • %RUSTUP_HOME%
  • 随后点击运行下载好的文件rustup-init.exe
  • 注意:Rust默认需要C++ build Tools (也就是MSVC运行库:微软VC编译器)才能安装,也就是说普通用户需要安装Viatual Studio2022或更高版本(社区版足矣),另外还要在在Viatual Studio installer额外勾选C++ build Tools,下载完成后才能适配(如果你是高级用户和企业用户可以自行配置C++ build Tools),如果读者的IDE就是Viatual Studio,那么推荐以这种默认方法安装,如果不是,以下会介绍非Viatual Studio的安装,即MinGW(MInimalist GNU on)运行库式安装的,但IDE还请各位自行适配。(如果还没有十分顺手的IDE的小伙伴采用此方法后续适配自己的IDE容易踩坑,但有利于学习,作者采用的是VSCode,跨平台好一些,追求方便快捷的可选用其他)
  • 以下为安装对话
Rust Visual C++ prerequisites Rust requires a linker and Windows API libraries but they don't seem to be available. These components can be acquired through a Visual Studio installer. 1) Quick install via the Visual Studio Community installer (free for individuals, academic uses, and open source). 2) Manually install the prerequisites (for enterprise and advanced users). 3) Don't install the prerequisites (if you're targetting the GNU ABI). >3 #此处为作者添加的对话:选择1会下载Visual Stdio;选择2表示你是高级用户或企业用户;选择3即是采用MinGW编译 Welcome to Rust! This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. Rustup metadata and toolchains will be installed into the Rustup home directory, located at: C:\WorkSpace\Rust_environment\.rustup This can be modified with the RUSTUP_HOME environment variable. The Cargo home directory is located at: C:\WorkSpace\Rust_environment\.cargo This can be modified with the CARGO_HOME environment variable. The cargo, rustc, rustup and other commands will be added to Cargo's bin directory, located at: C:\WorkSpace\Rust_environment\.cargo\bin This path will then be added to your PATH environment variable by modifying the HKEY_CURRENT_USER/Environment/PATH registry key. You can uninstall at any time with rustup self uninstall and these changes will be reverted. Current installation options: default host triple: x86_64-pc-windows-msvc default toolchain: stable (default) profile: default modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation 3) Cancel installation >2 #此处为作者添加的对话:选1表示默认当前配置安装,选2表示自定义这些配置,选3表示取消安装 I'm going to ask you the value of each of these installation options. You may simply press the Enter key to leave unchanged. Default host triple? [x86_64-pc-windows-msvc] x86_64-pc-windows-gnu #此处为作者添加的对话:修改为x86_64-pc-windows-gnu而不是默认的x86_64-pc-windows-msvc Default toolchain? (stable/beta/nightly/none) [stable] stable #此处为作者添加的对话:为了稳定更新,默认stable就stable Profile (which tools and data to install)? (minimal/default/complete) [default] default #此处为作者添加的对话:下载默认的工具有利于学习文档的辅助学习,所以还是按默认的来 Modify PATH variable? (Y/n) Y #此处为作者添加的对话:同意添加环境变量,也可自定义 Current installation options: default host triple: x86_64-pc-windows-gnu default toolchain: stable profile: default modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation 3) Cancel installation >1 #此处为作者添加的对话:确认配置无误,按此配置安装,选1 info: profile set to 'default' info: setting default host triple to x86_64-pc-windows-gnu info: syncing channel updates for 'stable-x86_64-pc-windows-gnu' info: latest update on 2022-11-03, rust version 1.65.0 (897e37553 2022-11-02) info: downloading component 'cargo' 7.3 MiB / 7.3 MiB (100 %) 3.1 MiB/s in 2s ETA: 0s info: downloading component 'clippy' 3.7 MiB / 3.7 MiB (100 %) 2.8 MiB/s in 1s ETA: 0s info: downloading component 'rust-docs' 18.9 MiB / 18.9 MiB (100 %) 3.1 MiB/s in 6s ETA: 0s info: downloading component 'rust-mingw' 4.2 MiB / 4.2 MiB (100 %) 3.2 MiB/s in 1s ETA: 0s info: downloading component 'rust-std' 28.1 MiB / 28.1 MiB (100 %) 2.9 MiB/s in 9s ETA: 0s info: downloading component 'rustc' 74.0 MiB / 74.0 MiB (100 %) 3.1 MiB/s in 25s ETA: 0s info: downloading component 'rustfmt' 6.6 MiB / 6.6 MiB (100 %) 3.1 MiB/s in 2s ETA: 0s info: installing component 'cargo' info: installing component 'clippy' info: installing component 'rust-docs' 18.9 MiB / 18.9 MiB (100 %) 1.8 MiB/s in 12s ETA: 0s info: installing component 'rust-mingw' info: installing component 'rust-std' 28.1 MiB / 28.1 MiB (100 %) 13.5 MiB/s in 2s ETA: 0s info: installing component 'rustc' 74.0 MiB / 74.0 MiB (100 %) 13.9 MiB/s in 9s ETA: 0s info: installing component 'rustfmt' info: default toolchain set to 'stable-x86_64-pc-windows-gnu' stable-x86_64-pc-windows-gnu installed - rustc 1.65.0 (897e37553 2022-11-02) Rust is installed now. Great! To get started you may need to restart your current shell. This would reload its PATH environment variable to include Cargo's bin directory (%USERPROFILE%\.cargo\bin). Press the Enter key to continue.

三、Hello,World

  • 新世界已经开始,言说不如实行,Rust的官方文档十分有利于新手学习,代码学习作者建议参照文档学习,本文中的文档链接是好心人的汉化文档,英文不好的小伙伴自行食用。

四、补充

  • 如果后续小伙伴采用rustc,Cargo进行编译时出现error: linking with x86_64-w64-mingw32-gcc failed: exit code: 1 的错误,可能是小伙伴事先安装了MinGW,可以将环境变量中的此值删除,另外发生此错误时同时会生成许多二进制文件,建议除了我们自己编写的文件(main.rs等等)以外,其他全部删除,重新编译。如果问题依然没有解决,请移至其他文章。

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/30056.html

    分享给朋友:

    “rustdesk 自建服务器 windows rust怎么自建服务器” 的相关文章

    Discover What is vip.qq.com: Unlock Exclusive QQ Member Benefits

    vip.qq.com简介 vip.qq.com是腾讯公司专门为QQ会员用户打造的官方网站。这个平台为会员提供了一系列专属的特权和服务,涵盖了社交、游戏、生活等多个方面。作为QQ会员的官方入口,vip.qq.com不仅是会员管理账户的中心,也是了解和使用各种会员功能的主要渠道。无论是等级加速、身份铭牌...

    如何用GoDaddy优惠码续费省更多?最新折扣码全解析

    什么是GoDaddy续费优惠码 GoDaddy续费优惠码是GoDaddy为用户提供的一种折扣工具,专门用于在续费时享受价格优惠。无论是续费域名、主机还是其他服务,这些优惠码都能帮助用户节省开支。优惠码通常以字母和数字的组合形式出现,用户只需在结账时输入或通过特定链接直接应用,即可享受相应的折扣。 续...

    云桌面是什么?解锁现代工作与学习的新方式

    云桌面是一个令人兴奋的概念,尤其是在如今这个数字化迅速发展的时代。我个人认为,云桌面不仅仅是一项技术,更是一种全新的工作方式。简单来说,云桌面是一种基于云计算的桌面虚拟化解决方案。它允许用户通过互联网随时随地访问一个在云端运行的桌面环境。想象一下,不论你在咖啡馆、家中还是办公室,只需一台设备和网络连...

    eno VPS:掌握网络接口命名规则与性能优化技巧

    在了解eno VPS之前,我们先来看看什么是eno命名规则。ena作为一种网络接口命名方式,通过特定的规则来表示Linux系统中的网络设备。这种规则帮助用户更容易地识别和管理各种网络接口。具体来说,eno采用的是eno[n|d]的格式,主要用于板载设备。而对于热插拔设备,则使用ens[f][n|d]...

    VPS流媒体解锁测试:确保顺畅访问全球流媒体内容

    在如今的互联网时代,流媒体已经成为我们日常生活中不可或缺的一部分。无论是观看热门电视剧,还是播放最新的音乐视频,流媒体服务的便捷性吸引了无数用户。然而,涉及不同地区提供的内容时,依然存在一些区域限制。这时,VPS(虚拟专用服务器)流媒体解锁技术的重要性便不言而喻。 VPS流媒体解锁是指通过虚拟专用服...

    大硬盘服务器的应用与优化建议

    大硬盘服务器,是一种为了存储大量数据而特别设计的服务器。它在数据存储和管理方面发挥着至关重要的作用,特别是在当今数据爆炸的时代。这样一台服务器不仅需要满足基本的存储需求,还应具备高效的性能。无论是企业的数据库管理、云计算服务,还是大数据分析,都会依赖这样的服务器进行支持。 我对大硬盘服务器的定义和用...