Github开源生信云平台 DEMO
https://forge.rust-lang.org/infra/other-installation-methods.html
./install.sh --prefix=/ssd1/wy/software/rust-1.93
rustc --version cargo --version
cargo new hello_cargo cargo build cargo run cargo check cargo run --bin server cargo run --bin client cargo run --bin gui
https://github.com/gollmdev/hello-rust
安装的可执行程序(cargo install)
~/.cargo/bin
下载的依赖包(crate 源码)
~/.cargo/registry
简单来说:mod 是告诉编译器“去哪里找代码”,而 use 是告诉编译器“怎么方便地称呼代码”。
mod
use
以下是详细的对比和原因:
mod network;
当你写 mod network; 时,你是在组织你自己的代码。
network.rs
network/mod.rs
#include "network.h"
// main.rs mod network; // 1. 把 network.rs 拉进编译范围 fn main() { // 2. 因为拉进来了,所以可以通过路径访问 network::tcp::connect(); }
use ...
当你写 use serde::Deserialize; 时,你是在简化路径。
use serde::Deserialize;
Cargo.toml
extern crate
using namespace std;
import java.util.List;
// 假设 network 是第三方库,或者你已经在上面 mod network; 了 // 没有 use:必须写全路径 network::tcp::connect(); // 有 use:简化路径 use network::tcp; fn main() { tcp::connect(); // 爽! }
这是最核心的区别:
编译入口不同:
main.rs
lib.rs
.rs
serde
src/lib.rs
命名空间隔离:
mod serde;
serde.rs
file not found
use serde::...
rustup update
rustup update stable
rustup default stable
rustup install nightly
rustup override set nightly
rustup show
rustup component add clippy rustfmt
rustup target add x86_64-unknown-linux-gnu
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none rustup install stable # 安装 stable rustup install nightly # 安装 nightly
应用层 UI 框架 ↓ Skia / Impeller / wgpu(抽象层) ↓ Vulkan / Metal / DX12 / OpenGL(图形 API) ↓ 显卡驱动 ↓ GPU 硬件
┌───────────────┐ │ UI 框架 │ └───────┬───────┘ │ ┌───────────────┼───────────────┐ │ │ Skia (2D引擎) wgpu │ │ └───────────────┬───────────────┘ │ Vulkan │ 驱动 │ GPU
这些框架通过绑定系统原生控件,实现 UI 样式原生:
这些框架自己管理渲染管线,适合高性能和自定义 UI: