pub struct VersionInfo {
pub prefix: Option<String>,
pub version: Version,
pub tag: String,
pub prerelease: bool,
}Expand description
Version information extracted from a Git tag.
VersionInfo represents a successfully parsed semantic version from a Git tag,
along with metadata about the original tag and prerelease status. This structure
is used throughout the version resolution system to maintain the connection
between semantic versions and their source Git references.
§Fields
prefix: Optional prefix for monorepo-style versioning (e.g.,"agents"inagents-v1.0.0)version: The parsed semantic versiontag: The original Git tag string (may include prefixes likevoragents-v)prerelease: Whether this version contains prerelease identifiers
§Examples
use agpm_cli::version::VersionInfo;
use semver::Version;
// Standard version without prefix
let info = VersionInfo {
prefix: None,
version: Version::parse("1.0.0-beta.1").unwrap(),
tag: "v1.0.0-beta.1".to_string(),
prerelease: true,
};
assert_eq!(info.prefix, None);
assert_eq!(info.version.major, 1);
assert_eq!(info.tag, "v1.0.0-beta.1");
assert!(info.prerelease);
// Prefixed version for monorepo
let prefixed = VersionInfo {
prefix: Some("agents".to_string()),
version: Version::parse("2.0.0").unwrap(),
tag: "agents-v2.0.0".to_string(),
prerelease: false,
};
assert_eq!(prefixed.prefix, Some("agents".to_string()));
assert_eq!(prefixed.version.major, 2);Fields§
§prefix: Option<String>Optional prefix for versioned namespaces (e.g., “agents”, “snippets”)
version: VersionThe parsed semantic version
tag: StringThe original Git tag string
prerelease: boolWhether this is a prerelease version (alpha, beta, rc, etc.)
Trait Implementations§
Source§impl Clone for VersionInfo
impl Clone for VersionInfo
Source§fn clone(&self) -> VersionInfo
fn clone(&self) -> VersionInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for VersionInfo
impl RefUnwindSafe for VersionInfo
impl Send for VersionInfo
impl Sync for VersionInfo
impl Unpin for VersionInfo
impl UnwindSafe for VersionInfo
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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