Skip to main content

VersionOracle

Struct VersionOracle 

Source
pub struct VersionOracle {
    pub public_release: bool,
    pub build_metadata: Vec<String>,
    pub extra_prerelease_identifiers: Vec<String>,
    pub building_ref: Option<String>,
    pub tags: Option<Vec<String>>,
    pub version: Version,
    pub git_commit_id: Option<String>,
    pub git_commit_id_short: Option<String>,
    pub version_height: u32,
    /* private fields */
}
Expand description

The complete set of version values calculated for a project.

Values that depend on public-release state or caller-supplied identifiers are exposed as methods because public_release, build_metadata, and extra_prerelease_identifiers remain mutable.

Fields§

§public_release: bool

Whether the calculated version is a public release.

§build_metadata: Vec<String>

Additional build metadata identifiers.

§extra_prerelease_identifiers: Vec<String>

Additional prerelease identifiers.

§building_ref: Option<String>

The ref (branch or tag) being built.

§tags: Option<Vec<String>>

Canonical tag refs that point at the selected commit.

§version: Version

The encoded numeric version.

§git_commit_id: Option<String>

The full selected commit ID, optionally suffixed by -dirty.

§git_commit_id_short: Option<String>

The abbreviated selected commit ID, optionally suffixed by -dirty.

§version_height: u32

The calculated version height.

Implementations§

Source§

impl VersionOracle

Source

pub fn new( context: &GitContext, cloud_build: Option<&dyn CloudBuild>, ) -> Result<Self>

Calculates version information from a Git context and optional cloud provider.

Source

pub fn new_with_height_offset( context: &GitContext, cloud_build: Option<&dyn CloudBuild>, override_version_height_offset: Option<i32>, ) -> Result<Self>

Calculates version information with an explicit version-height offset override.

Source

pub fn version_options(&self) -> Option<&VersionOptions>

Gets the options selected by the oracle.

Source

pub fn committed_version(&self) -> Option<&VersionOptions>

Gets the committed options.

Source

pub fn working_version(&self) -> Option<&VersionOptions>

Gets the working-copy options.

Source

pub fn version_file_found(&self) -> bool

Gets whether a version file was found.

Source

pub fn version_height_offset(&self) -> i32

Gets the effective height offset.

Source

pub fn version_height_with_offset(&self) -> i64

Gets the height including its effective offset.

Source

pub fn assembly_version(&self) -> Version

Gets the assembly version.

Source

pub const fn assembly_file_version(&self) -> Version

Gets the assembly file version.

Source

pub fn assembly_informational_version(&self) -> String

Gets the assembly informational version.

Source

pub fn prerelease_version(&self) -> String

Gets the prerelease fragment, including a leading hyphen.

Source

pub fn prerelease_version_no_leading_hyphen(&self) -> String

Gets the prerelease fragment without leading hyphens.

Source

pub fn simple_version(&self) -> Version

Gets the numeric version without its revision component.

Source

pub fn build_number(&self) -> u32

Gets the third numeric component, treating an unspecified value as zero.

Source

pub fn version_revision(&self) -> i64

Gets the fourth numeric component using -1 when unspecified.

Source

pub const fn major_minor_version(&self) -> Version

Gets the major/minor numeric version.

Source

pub const fn git_commit_date(&self) -> Option<DateTime<FixedOffset>>

Gets the selected commit’s committer date.

Source

pub const fn git_commit_author_date(&self) -> Option<DateTime<FixedOffset>>

Gets the selected commit’s author date.

Source

pub fn build_metadata_with_commit_id(&self) -> Vec<String>

Gets build metadata with the selected commit ID first.

Source

pub fn build_metadata_fragment(&self) -> String

Gets the +-prefixed build metadata fragment used by calculated versions.

Source

pub fn sem_ver1(&self) -> String

Gets the SemVer 1 representation.

Source

pub fn sem_ver2(&self) -> String

Gets the SemVer 2 representation.

Source

pub fn nuget_package_version(&self) -> String

Gets the NuGet package version.

Source

pub fn chocolatey_package_version(&self) -> String

Gets the Chocolatey package version.

Source

pub fn npm_package_version(&self) -> String

Gets the NPM package version.

Source

pub fn sem_ver1_numeric_identifier_padding(&self) -> u32

Gets the SemVer 1 numeric-identifier padding.

Source

pub fn cloud_build_number(&self) -> String

Gets the cloud build number.

Source

pub fn cloud_build_number_enabled(&self) -> bool

Gets whether setting the cloud build number is enabled.

Source

pub fn cloud_build_all_vars_enabled(&self) -> bool

Gets whether all NBGV_ variables should be set.

Source

pub fn cloud_build_version_vars_enabled(&self) -> bool

Gets whether common version variables should be set.

Source

pub fn cloud_build_version_vars(&self) -> BTreeMap<String, String>

Gets the common cloud-build variables.

Source

pub fn cloud_build_all_vars(&self) -> BTreeMap<String, String>

Gets every cloud-build variable exposed by the managed oracle.

Trait Implementations§

Source§

impl Clone for VersionOracle

Source§

fn clone(&self) -> Self

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 VersionOracle

Source§

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

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

impl Serialize for VersionOracle

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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<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
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> 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, !>

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.