pub struct Package {
pub name: Name,
pub release_notes: ReleaseNotes,
/* private fields */
}Fields§
§name: Name§release_notes: ReleaseNotesImplementations§
Source§impl Package
impl Package
Sourcepub fn new<S: AsRef<str> + Debug>(
name: Name,
git_tags: &[S],
versioned_files_tracked: Vec<Config>,
all_versioned_files: &[VersionedFile],
release_notes: ReleaseNotes,
scopes: Option<Vec<String>>,
) -> Result<Self, Box<NewError>>
pub fn new<S: AsRef<str> + Debug>( name: Name, git_tags: &[S], versioned_files_tracked: Vec<Config>, all_versioned_files: &[VersionedFile], release_notes: ReleaseNotes, scopes: Option<Vec<String>>, ) -> Result<Self, Box<NewError>>
Try and combine a bunch of versioned files into one logical package.
§Errors
There must be at least one versioned file, and all files must have the same version.
Sourcepub fn set_version(
&mut self,
version: Version,
go_versioning: GoVersioning,
versioned_files: Vec<VersionedFile>,
) -> Result<Vec<VersionedFile>, BumpError>
pub fn set_version( &mut self, version: Version, go_versioning: GoVersioning, versioned_files: Vec<VersionedFile>, ) -> Result<Vec<VersionedFile>, BumpError>
Returns the actions that must be taken to set this package to the new version, along with the version it was set to.
The version can either be calculated from a semver rule or specified manually.
§Errors
If the file is a go.mod, there are rules about what versions are allowed.
If serialization of some sort fails, which is a bug, then this will return an error.
If the Rule::Release is specified, but there is no current prerelease, that’s an
error too.
pub fn get_changes<'a>( &self, changeset: impl IntoIterator<Item = (&'a PackageChange, Option<GitInfo>)>, commit_messages: &[Commit], ) -> Vec<Change>
Sourcepub fn apply_changes(
&mut self,
changes: &[Change],
versioned_files: Vec<VersionedFile>,
config: ChangeConfig,
) -> Result<(Vec<VersionedFile>, Vec<Action>), BumpError>
pub fn apply_changes( &mut self, changes: &[Change], versioned_files: Vec<VersionedFile>, config: ChangeConfig, ) -> Result<(Vec<VersionedFile>, Vec<Action>), BumpError>
Apply changes to the package, updating the internal version and returning the list of actions to take to complete the changes.
§Errors
If the file is a go.mod, there are rules about what versions are allowed.
If serialization of some sort fails, which is a bug, then this will return an error.
pub fn latest_version(&self) -> Option<Version>
Sourcepub fn calculate_new_version(&self, rule: Rule) -> Result<Version, BumpError>
pub fn calculate_new_version(&self, rule: Rule) -> Result<Version, BumpError>
Apply a Rule to a [PackageVersion], incrementing & resetting the correct components.
§Versions 0.x
Versions with major component 0 have special meaning in Semantic Versioning and therefore have different behavior:
- [
Rule::Major] will bump the minor component. - [
Stable(Minor)] will bump the patch component.
§Errors
Can fail if trying to run Rule::Release when there is no pre-release.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnsafeUnpin for Package
impl UnwindSafe for Package
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more