diff --git a/Cargo.lock b/Cargo.lock index c8450bc4b79..6fca15b18a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,7 +461,7 @@ dependencies = [ [[package]] name = "cargo-util-schemas" -version = "0.5.0" +version = "0.5.1" dependencies = [ "semver", "serde", diff --git a/crates/cargo-util-schemas/Cargo.toml b/crates/cargo-util-schemas/Cargo.toml index d883e6f2e4f..cef0bf6cafb 100644 --- a/crates/cargo-util-schemas/Cargo.toml +++ b/crates/cargo-util-schemas/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-util-schemas" -version = "0.5.0" +version = "0.5.1" rust-version = "1.79" # MSRV:1 edition.workspace = true license.workspace = true diff --git a/crates/cargo-util-schemas/src/manifest/mod.rs b/crates/cargo-util-schemas/src/manifest/mod.rs index 96509d91fc2..fe954f0f4ca 100644 --- a/crates/cargo-util-schemas/src/manifest/mod.rs +++ b/crates/cargo-util-schemas/src/manifest/mod.rs @@ -111,7 +111,7 @@ impl TomlManifest { } } -#[derive(Debug, Deserialize, Serialize, Clone)] +#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[serde(rename_all = "kebab-case")] pub struct TomlWorkspace { pub members: Option>, @@ -199,6 +199,44 @@ pub struct TomlPackage { } impl TomlPackage { + pub fn new(name: PackageName) -> Self { + Self { + name, + + edition: None, + rust_version: None, + version: None, + authors: None, + build: None, + metabuild: None, + default_target: None, + forced_target: None, + links: None, + exclude: None, + include: None, + publish: None, + workspace: None, + im_a_teapot: None, + autobins: None, + autoexamples: None, + autotests: None, + autobenches: None, + default_run: None, + description: None, + homepage: None, + documentation: None, + readme: None, + keywords: None, + categories: None, + license: None, + license_file: None, + repository: None, + resolver: None, + metadata: None, + _invalid_cargo_features: None, + } + } + pub fn resolved_edition(&self) -> Result, UnresolvedError> { self.edition.as_ref().map(|v| v.resolved()).transpose() }