首页 > 解决方案 > 在而不是包清单

问题描述

[rust] "instead of a package manifest"在询问之前我在这个网站上搜索过,没有找到任何点击。我还在这里阅读了有关虚拟清单的信息,但没有解决我的问题。

我的目标是对azul进行更改。

为了实现这一点,我在这里阅读了有关修补依赖项的信息,现在我有了这个Cargo.toml

[package]
name = "my_first_azul_app"
version = "0.1.0"
authors = ["Name <Email>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
azul = { git = "https://github.com/maps4print/azul" }

[patch."https://github.com/maps4print/azul"]
azul = { path = "../azul" }

在路径../azul中,我检查了 azul 项目git clone。在main.rs我遵循这个得到,

extern crate azul;

fn main() {
    println!("Hello world!");
}

然后我尝试测试

$ cargo run
error: failed to resolve patches for `https://github.com/maps4print/azul`

Caused by:
  failed to load source for a dependency on `azul`

Caused by:
  Unable to update /home/name/projects/azul

Caused by:
  found a virtual manifest at `/home/name/projects/azul/Cargo.toml` instead of a package manifest

我不明白最终造成的线路。如果我删除[patch]配置,它会“工作”。引用是因为它无法编译,但这就是我试图检查它并尝试修复的原因。我需要支付什么费用来开发azul依赖项?

TIA,

标签: rustrust-cargo

解决方案


看起来 azul 正在使用工作区,因此如果您想通过路径引用它,您必须指向该工作区的确切成员。

azul 的 Cargo.toml 包含


[workspace]
members = [
    "cargo/azul",
    "cargo/azul-css",
    "cargo/azul-core",
    "cargo/azul-layout",
    "cargo/azul-text-layout",
    "cargo/azul-widgets",
    "cargo/azul-css-parser",
    "cargo/azul-native-style",
]

所以我相信你应该能够做类似的事情:


[dependencies]
azul = { path = "../azul/cargo/azul"
azul-css = { path = "../azul/cargo/azul-css" }

您可能需要那里的所有/部分成员。


推荐阅读