W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
Cargo 清單文件用于聲明您的應(yīng)用程序依賴、應(yīng)用元數(shù)據(jù)和其他 Rust 相關(guān)功能。 若您不需要 Rust 進(jìn)行后端開發(fā),您可能不需要修改此文件。 但了解它的存在意義及其功能還是很重要的。
下方是一個(gè) Tauri 項(xiàng)目的示例 文件:?Cargo.toml
?
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.57"
[build-dependencies]
tauri-build = { version = "1.0.0" }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0", features = [ "api-all" ] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
您要注意的最主要部分是 及 依賴。 Generally, they must both be on the latest minor versions as the Tauri CLI, but this is not strictly required. 如果你在運(yùn)行你的應(yīng)用時(shí)遇到問題,應(yīng)檢查 和 是否是最新的次要版本上。tauri-build
tauri
tauri
tauri-cli
Cargo 版本號(hào)使用語義化版本(SemVer)控制。 運(yùn)行 指令將拉取最新可用的語義版本依賴。 For example, if you specify as the version for , Cargo will detect and download version because it is the latest Semver-compatible version available. 當(dāng)出現(xiàn)突破性更改時(shí),Tauri 將更新主要版本號(hào)。 你能夠安全地升級(jí)到最新的次要版本和補(bǔ)丁版本,而不必?fù)?dān)心你的代碼中會(huì)有破壞性改變。cargo update
1.0.0
tauri-build
1.0.4
如果要使用特定的 crate 版本,可以通過在依賴項(xiàng)的版本號(hào)前面加上來使用精確的版本:=
tauri-bution = Power version = "=1.0.0" }
另外一件需要注意的事情是依賴項(xiàng)的部分。執(zhí)行 以及 會(huì)基于你在 中的屬性 設(shè)置需要開啟的功能進(jìn)行自動(dòng)管理。features=[]
tauri
tauri dev
tauri build
tauri.conf.json
"allowlist"
當(dāng)您構(gòu)建應(yīng)用程序時(shí),將生成 文件。此文件主要用于確保在開發(fā)過程中跨計(jì)算機(jī)使用相同的依賴項(xiàng)(類似于 Node.js 或 )。由于您正在開發(fā) Tauri 應(yīng)用程序,因此應(yīng)將此文件提交到您的源存儲(chǔ)庫(kù)(只有 Rust 庫(kù)應(yīng)該省略提交此文件)。Cargo.lock
yarn.lock
package-lock.json
要了解更多有關(guān) 的信息,您可以參閱其官方文檔。Cargo.toml
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: