pub struct CliVersion {
pub major: u32,
pub minor: u32,
pub patch: u32,
}Expand description
A parsed Claude CLI version (semver).
§Example
use claude_wrapper::CliVersion;
let v: CliVersion = "2.1.71".parse().unwrap();
assert_eq!(v.major, 2);
assert_eq!(v.minor, 1);
assert_eq!(v.patch, 71);
let min: CliVersion = "2.1.0".parse().unwrap();
assert!(v >= min);Fields§
§major: u32§minor: u32§patch: u32Implementations§
Source§impl CliVersion
impl CliVersion
Sourcepub fn parse_version_output(output: &str) -> Result<Self, VersionParseError>
pub fn parse_version_output(output: &str) -> Result<Self, VersionParseError>
Parse a version from the output of claude --version.
Expects format like "2.1.71 (Claude Code)" or just "2.1.71".
Sourcepub fn satisfies_minimum(&self, minimum: &CliVersion) -> bool
pub fn satisfies_minimum(&self, minimum: &CliVersion) -> bool
Check if this version satisfies a minimum version requirement.
Sourcepub fn status_within(
&self,
min: &CliVersion,
max: &CliVersion,
) -> CliVersionStatus
pub fn status_within( &self, min: &CliVersion, max: &CliVersion, ) -> CliVersionStatus
Classify this version against a tested-against [min, max]
range (both inclusive).
Use to decide whether a host should warn about CLI drift. The minimum is the floor we’ve verified the wrapper still works against; the maximum is the upper end of the tested-against window. A version below the minimum is a hard “we know this is broken”; a version above the maximum is a soft “we haven’t verified this; semantics may have drifted.”
Trait Implementations§
Source§impl Clone for CliVersion
impl Clone for CliVersion
Source§fn clone(&self) -> CliVersion
fn clone(&self) -> CliVersion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CliVersion
Source§impl Debug for CliVersion
impl Debug for CliVersion
Source§impl Display for CliVersion
impl Display for CliVersion
impl Eq for CliVersion
Source§impl FromStr for CliVersion
impl FromStr for CliVersion
Source§impl Ord for CliVersion
impl Ord for CliVersion
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CliVersion
impl PartialEq for CliVersion
Source§fn eq(&self, other: &CliVersion) -> bool
fn eq(&self, other: &CliVersion) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for CliVersion
impl PartialOrd for CliVersion
Source§impl Serialize for CliVersion
impl Serialize for CliVersion
impl StructuralPartialEq for CliVersion
Auto Trait Implementations§
impl Freeze for CliVersion
impl RefUnwindSafe for CliVersion
impl Send for CliVersion
impl Sync for CliVersion
impl Unpin for CliVersion
impl UnsafeUnpin for CliVersion
impl UnwindSafe for CliVersion
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