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

source

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

source

pub const LOCAL: Self = _

source§

impl CrateVersion

source

pub const fn new(major: u8, minor: u8, patch: u8) -> Self

source

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.

source

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.

source

pub fn is_alpha(&self) -> bool

Whether or not this is an alpha version (-alpha.N or -alpha.N+dev).

source

pub fn is_rc(&self) -> bool

Whether or not this is a release candidate (-rc.N).

source

pub fn from_bytes([major, minor, patch, meta]: [u8; 4]) -> Self

From a compact 32-bit representation crated with Self::to_bytes.

source

pub fn to_bytes(self) -> [u8; 4]

A compact 32-bit representation. See also Self::from_bytes.

source

pub fn is_compatible_with(self, other: Self) -> bool

source§

impl CrateVersion

source

pub const fn parse(version_string: &'static str) -> Self

Parse a version string according to our subset of semver.

See CrateVersion for more information.

source

pub const fn try_parse( version_string: &'static str, ) -> Result<Self, &'static str>

Parse a version string according to our subset of semver.

See CrateVersion for more information.

Trait Implementations§

source§

impl Clone for CrateVersion

source§

fn clone(&self) -> CrateVersion

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CrateVersion

source§

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

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

impl Display for CrateVersion

source§

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

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

impl Ord for CrateVersion

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for CrateVersion

source§

fn eq(&self, other: &CrateVersion) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for CrateVersion

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl SizeBytes for CrateVersion

source§

fn heap_size_bytes(&self) -> u64

Returns how many bytes self uses on the heap. Read more
§

fn total_size_bytes(&self) -> u64

Returns the total size of self in bytes, accounting for both stack and heap space.
§

fn stack_size_bytes(&self) -> u64

Returns the total size of self on the stack, in bytes. Read more
§

fn is_pod() -> bool

Is Self just plain old data? Read more
source§

impl Copy for CrateVersion

source§

impl Eq for CrateVersion

source§

impl StructuralPartialEq for CrateVersion

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: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> Ungil for T
where T: Send,