Skip to main content

Unit

Struct Unit 

Source
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: String

Release graph ID, the key in the configured units.

§package_name: Option<String>

Ecosystem package identifier, kept separate from the release graph ID.

§version: Version

Version on the authoritative branch.

§target: ReleaseTarget

Where the version lives and how the unit is published.

§source: SourceDirectories

Repository directories whose changes trigger a release.

§changelog: Option<RepositoryPath>

Repository path of the unit changelog, absent for a unit without one.

§tag_prefix: String

Prefix 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

Source

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.

Source

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

Source

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.

Source

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.

Source

pub(crate) fn read_revision( root: &RepositoryRoot, revision_file: &RepositoryPath, ) -> Result<u64, ResolveError>

Source§

impl Unit

Source

pub(crate) fn bumped(&self, bump: Bump) -> Result<Version, ProposalError>

Source

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.

Source

pub(crate) fn transitive_dependents( units: &[Self], affected: BTreeSet<String>, ) -> BTreeSet<String>

Source§

impl Unit

Source

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.

Source

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

Source

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

Source

pub(crate) fn title(&self) -> String

The title of this unit’s forge release.

Source

pub(crate) const fn version_path(&self) -> &RepositoryPath

The repository path of the file that holds this unit’s version.

Source

pub(crate) fn tag(&self) -> String

The Git tag for this unit’s current version: the configured prefix plus version, with the revision appended when one is configured.

Trait Implementations§

Source§

impl Clone for Unit

Source§

fn clone(&self) -> Unit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Unit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Unit

Source§

impl PartialEq for Unit

Source§

fn eq(&self, other: &Unit) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more