Skip to content

Commit

Permalink
Add PackageBuilder::new
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Nov 17, 2024
1 parent dcb47f5 commit 7a623f7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,23 @@ pub struct Package {
pub rust_version: Option<Version>,
}

#[cfg(feature = "builder")]
impl PackageBuilder {
/// Construct a new `PackageBuilder` with all required fields.
pub fn new(
name: impl Into<String>,
version: impl Into<Version>,
id: impl Into<PackageId>,
path: impl Into<Utf8PathBuf>,
) -> Self {
Self::default()
.name(name)
.version(version)
.id(id)
.manifest_path(path)
}
}

impl Package {
/// Full path to the license file if one is present in the manifest
pub fn license_file(&self) -> Option<Utf8PathBuf> {
Expand Down

0 comments on commit 7a623f7

Please sign in to comment.