Skip to main content

ReleaseState

Struct ReleaseState 

Source
pub struct ReleaseState {
    pub status: ReleaseStatus,
    pub scope: String,
    pub scope_path: String,
    pub current_version: Option<String>,
    pub pending_commits: usize,
    pub changelog: String,
    pub version_consistent: Option<bool>,
}
Expand description

发布阶段状态快照。

记录一个 scope 在某个时刻的发布状态快照。 与 [VersionState] 的关系:VersionState 聚焦版本号一致性, ReleaseState 聚焦发布生命周期阶段。

Fields§

§status: ReleaseStatus

发布生命周期状态。

§scope: String

scope 名称。

§scope_path: String

scope 相对路径。

§current_version: Option<String>

当前最新 tag 版本号(若有)。

§pending_commits: usize

自最新 tag 以来的未发布提交数。

§changelog: String

变更日志路径。

§version_consistent: Option<bool>

版本一致性检查结果(空表示未检查或不适用)。

Implementations§

Source§

impl ReleaseState

Source

pub fn new( status: ReleaseStatus, scope: impl Into<String>, scope_path: impl Into<String>, current_version: Option<String>, pending_commits: usize, version_consistent: Option<bool>, ) -> Self

构造一个发布状态快照,变更日志默认使用 "CHANGELOG.md"

use quanttide_devops::stage::release::{ReleaseState, ReleaseStatus};

let s = ReleaseState::new(
    ReleaseStatus::Pending,
    "cli",
    "src/cli",
    Some("v1.2.3".into()),
    3,
    Some(true),
);
assert_eq!(s.scope, "cli");
assert_eq!(s.changelog, "CHANGELOG.md");

Trait Implementations§

Source§

impl Debug for ReleaseState

Source§

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

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

impl Display for ReleaseState

多行报告格式,与平台 status_to 输出一致:

  [scope]
    状态:         已是最新
    路径:         src/cli
    最新版本:     v1.2.3
    未发布提交:   0
    变更日志:     CHANGELOG.md
    版本一致:     是
Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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.