rust开发环境配置

环境

manjaro

sudo pacman -S rustup

rustup default stable
cargo install rustfmt

vscode

ext install rust-lang.rust-analyzer
ext install serayuzgur.crates
ext install tamasfe.even-better-toml

创建项目

cargo new xxx

调试模板

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "rust",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceRoot}/target/debug/${workspaceFolderBasename}",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceRoot}",
      "environment": [],
      "preLaunchTask": "build"
    }
  ]
}

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "build",
      "type": "shell",
      "command": "cargo build"
    }
  ]
}
posted @ 2022-12-21 07:44  自由出土文物  阅读(53)  评论(0编辑  收藏  举报