pub struct RunnerVersion { /* private fields */ }Expand description
A runner package version, such as 2.330.0.
§Why this is parsed rather than carried as a string
The version becomes a directory name under the cache root, and it is
derived from a filename GitHub sends over the wire. A string taken on trust
there is a path component taken on trust: .., foo/bar, C:\x and an
empty segment are all things a hostile or merely broken response could
supply. RunnerVersion::parse admits only two to four dot-separated runs
of ASCII digits, which cannot spell any of them.
Ordering is numeric per component, so 2.9.0 < 2.10.0. Nothing in this
module makes a safety decision from that ordering — freshness is decided
from install time, not from version order — but a deterministic order makes
PackageCache::installed stable.
Implementations§
Source§impl RunnerVersion
impl RunnerVersion
Sourcepub fn parse(raw: &str) -> Result<Self, PackageError>
pub fn parse(raw: &str) -> Result<Self, PackageError>
§Errors
PackageError::UnrecognisedVersion when raw is not two to four
dot-separated runs of ASCII digits.
Sourcepub fn from_filename(filename: &str) -> Result<Self, PackageError>
pub fn from_filename(filename: &str) -> Result<Self, PackageError>
The version embedded in a published filename such as
actions-runner-win-x64-2.330.0.zip.
GitHub’s runner-downloads response carries no version field — the only version signal it publishes is inside the filename and the URL — so this is where the cache’s directory names come from.
§Errors
PackageError::UnsupportedArchive when the extension is neither
.zip nor .tar.gz/.tgz, and PackageError::UnrecognisedVersion
when the trailing segment is not a version.
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl Clone for RunnerVersion
impl Clone for RunnerVersion
Source§fn clone(&self) -> RunnerVersion
fn clone(&self) -> RunnerVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunnerVersion
impl Debug for RunnerVersion
Source§impl<'de> Deserialize<'de> for RunnerVersion
impl<'de> Deserialize<'de> for RunnerVersion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RunnerVersion
impl Display for RunnerVersion
impl Eq for RunnerVersion
Source§impl From<RunnerVersion> for String
impl From<RunnerVersion> for String
Source§fn from(value: RunnerVersion) -> Self
fn from(value: RunnerVersion) -> Self
Source§impl Hash for RunnerVersion
impl Hash for RunnerVersion
Source§impl Ord for RunnerVersion
impl Ord for RunnerVersion
Source§fn cmp(&self, other: &RunnerVersion) -> Ordering
fn cmp(&self, other: &RunnerVersion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RunnerVersion
impl PartialEq for RunnerVersion
Source§impl PartialOrd for RunnerVersion
impl PartialOrd for RunnerVersion
Source§impl Serialize for RunnerVersion
impl Serialize for RunnerVersion
impl StructuralPartialEq for RunnerVersion
Auto Trait Implementations§
impl Freeze for RunnerVersion
impl RefUnwindSafe for RunnerVersion
impl Send for RunnerVersion
impl Sync for RunnerVersion
impl Unpin for RunnerVersion
impl UnsafeUnpin for RunnerVersion
impl UnwindSafe for RunnerVersion
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.