pub(crate) struct Unit {
pub name: String,
pub package_name: Option<String>,
pub version: Version,
pub target: ReleaseTarget,
pub source: SourceDirectories,
pub changelog: Option<RepositoryPath>,
pub tag_prefix: String,
pub dependencies: Vec<String>,
pub pins: BTreeMap<String, Pin>,
pub revision: Option<u64>,
}Expand description
One package in a release graph.
Fields§
§name: StringRelease graph ID, the key in the configured units.
package_name: Option<String>Ecosystem package identifier, kept separate from the release graph ID.
version: VersionVersion on the authoritative branch.
target: ReleaseTargetWhere the version lives and how the unit is published.
source: SourceDirectoriesRepository directories whose changes trigger a release.
changelog: Option<RepositoryPath>Repository path of the unit changelog, absent for a unit without one.
tag_prefix: StringPrefix used for the unit’s Git tag and release.
dependencies: Vec<String>Release graph IDs this unit is published after.
pins: BTreeMap<String, Pin>Files holding the versions of dependencies, keyed by dependency.
revision: Option<u64>Current value of the configured revision file, when one is set.
Implementations§
Source§impl Unit
impl Unit
Sourcefn check_increasing(&self, target: &Proposed) -> Result<(), ResolveError>
fn check_increasing(&self, target: &Proposed) -> Result<(), ResolveError>
Reject a target that does not move this unit forward. A first
release may stay at the current version.
Sourcepub(crate) fn configured(
name: &str,
package_name: Option<String>,
version: Version,
configured: &ReleaseUnitState,
) -> Self
pub(crate) fn configured( name: &str, package_name: Option<String>, version: Version, configured: &ReleaseUnitState, ) -> Self
A resolved unit for the configured name, at the version its target
holds today.
Source§impl Unit
impl Unit
Sourcepub(crate) fn required_bump(
&self,
root: &RepositoryRoot,
baseline_tag: &str,
) -> Result<Bump, ResolveError>
pub(crate) fn required_bump( &self, root: &RepositoryRoot, baseline_tag: &str, ) -> Result<Bump, ResolveError>
The smallest bump the unit’s public API changes since baseline_tag
require.
Sourcepub(crate) fn release_notes(
&self,
root: &RepositoryRoot,
) -> Result<String, ResolveError>
pub(crate) fn release_notes( &self, root: &RepositoryRoot, ) -> Result<String, ResolveError>
The changelog section of the unit’s version, empty when the unit has no changelog or the file or section does not exist.
pub(crate) fn read_revision( root: &RepositoryRoot, revision_file: &RepositoryPath, ) -> Result<u64, ResolveError>
Source§impl Unit
impl Unit
pub(crate) fn bumped(&self, bump: Bump) -> Result<Version, ProposalError>
Sourcefn bumped_in_development(&self, bump: Bump) -> Result<Version, ProposalError>
fn bumped_in_development(&self, bump: Bump) -> Result<Version, ProposalError>
Apply a bump, turning a major bump below 1.0.0 into a minor one.
pub(crate) fn transitive_dependents( units: &[Self], affected: BTreeSet<String>, ) -> BTreeSet<String>
Source§impl Unit
impl Unit
Sourcefn check_digest_pins(
&self,
repository: &RepositoryRoot,
staged: &Stage,
selected: &BTreeSet<String>,
) -> Result<(), PublicationError>
fn check_digest_pins( &self, repository: &RepositoryRoot, staged: &Stage, selected: &BTreeSet<String>, ) -> Result<(), PublicationError>
Check that every digest pin of a selected dependency holds the
digest of the staged asset it names.
A digest pin changes only in the release commit of its dependency, and that release selects the dependency, so the check sees every changed pin. The staged asset of an unselected dependency is a fresh build, not the published asset.
Sourcepub(crate) fn package_file(
&self,
configured: Option<&BTreeMap<String, ReleaseArtifactState>>,
staged: &Stage,
) -> Result<Option<PathBuf>, PublicationError>
pub(crate) fn package_file( &self, configured: Option<&BTreeMap<String, ReleaseArtifactState>>, staged: &Stage, ) -> Result<Option<PathBuf>, PublicationError>
The staged package file of a unit that publishes to a registry.
A unit that does not publish needs none and may not declare one.
Source§impl Unit
impl Unit
Sourcepub(crate) fn status<'t>(
&self,
tags: &'t [String],
) -> Result<UnitStatus<'t>, UnparsableTag>
pub(crate) fn status<'t>( &self, tags: &'t [String], ) -> Result<UnitStatus<'t>, UnparsableTag>
The status of this unit given the tags under its prefix.
§Errors
Returns an error when tags exist and none of them names a version.
Source§impl Unit
impl Unit
Sourcepub(crate) const fn version_path(&self) -> &RepositoryPath
pub(crate) const fn version_path(&self) -> &RepositoryPath
The repository path of the file that holds this unit’s version.
Trait Implementations§
impl Eq for Unit
impl StructuralPartialEq for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.