Struct re_build_info::crate_version::CrateVersion
source · pub struct CrateVersion {
pub major: u8,
pub minor: u8,
pub patch: u8,
pub meta: Option<Meta>,
}
Expand description
The version of a Rerun crate.
Sub-set of semver supporting major.minor.patch-{alpha,rc}.N+dev
.
The string value of build metadata is not preserved.
Examples: 1.2.3
, 1.2.3-alpha.4
, 1.2.3-alpha.1+dev
.
-alpha.N+dev
versions are used for local or CI builds.
-alpha.N
versions are used for weekly releases.
-rc.N
versions are used for release candidates as we’re preparing for a full release.
The version numbers (N
) aren’t allowed to be very large (current max: 63).
This limited subset is chosen so that we can encode the version in 32 bits
in our .rrd
files and on the wire.
Here is the current binary format:
major minor patch meta
00000000 00000000 00000000 00NNNNNN
▲▲▲ ▲
││└─┬──┘
││ └─ N
│└─ rc/dev
└─ alpha
The valid bit patterns for meta
are:
10NNNNNN
->-alpha.N
11NNNNNN
->-alpha.N+dev
01NNNNNN
->-rc.N
00000000
-> none of the above
Fields§
§major: u8
§minor: u8
§patch: u8
§meta: Option<Meta>
Implementations§
source§impl CrateVersion
impl CrateVersion
sourcepub fn try_parse_from_build_info_string(
s: impl AsRef<str>,
) -> Result<Self, String>
pub fn try_parse_from_build_info_string( s: impl AsRef<str>, ) -> Result<Self, String>
Attempts to parse a CrateVersion
from a BuildInfo
’s string representation (rerun --version
).
Refer to BuildInfo as std::fmt::Display>::fmt
to see what the string representation is
expected to look like. Roughly:
<name> <semver> [<rust_info>] <target> <branch> <commit> <build_date>
source§impl CrateVersion
impl CrateVersion
source§impl CrateVersion
impl CrateVersion
pub const fn new(major: u8, minor: u8, patch: u8) -> Self
sourcepub fn is_release(&self) -> bool
pub fn is_release(&self) -> bool
True is this version has no metadata at all (rc, dev, alpha, etc).
I.e. it’s an actual, final release.
sourcepub fn is_dev(&self) -> bool
pub fn is_dev(&self) -> bool
Whether or not this build has a +dev
suffix.
This is used to identify builds which are not explicit releases, such as local builds and CI builds for every commit.
sourcepub fn is_alpha(&self) -> bool
pub fn is_alpha(&self) -> bool
Whether or not this is an alpha version (-alpha.N
or -alpha.N+dev
).
sourcepub fn from_bytes([major, minor, patch, meta]: [u8; 4]) -> Self
pub fn from_bytes([major, minor, patch, meta]: [u8; 4]) -> Self
From a compact 32-bit representation crated with Self::to_bytes
.
sourcepub fn to_bytes(self) -> [u8; 4]
pub fn to_bytes(self) -> [u8; 4]
A compact 32-bit representation. See also Self::from_bytes
.
pub fn is_compatible_with(self, other: Self) -> bool
source§impl CrateVersion
impl CrateVersion
sourcepub const fn parse(version_string: &'static str) -> Self
pub const fn parse(version_string: &'static str) -> Self
Parse a version string according to our subset of semver.
See CrateVersion
for more information.
Trait Implementations§
source§impl Clone for CrateVersion
impl Clone for CrateVersion
source§fn clone(&self) -> CrateVersion
fn clone(&self) -> CrateVersion
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CrateVersion
impl Debug for CrateVersion
source§impl Display for CrateVersion
impl Display for CrateVersion
source§impl Ord for CrateVersion
impl Ord for CrateVersion
source§impl PartialEq for CrateVersion
impl PartialEq for CrateVersion
source§fn eq(&self, other: &CrateVersion) -> bool
fn eq(&self, other: &CrateVersion) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for CrateVersion
impl PartialOrd for CrateVersion
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl SizeBytes for CrateVersion
impl SizeBytes for CrateVersion
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
uses on the heap. Read more§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl Copy for CrateVersion
impl Eq for CrateVersion
impl StructuralPartialEq for CrateVersion
Auto Trait Implementations§
impl Freeze for CrateVersion
impl RefUnwindSafe for CrateVersion
impl Send for CrateVersion
impl Sync for CrateVersion
impl Unpin for CrateVersion
impl UnwindSafe for CrateVersion
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.