Struct BuildMetadata
struct BuildMetadata { ... }
Optional build metadata identifier. This comes after + in a SemVer
version, as in 0.8.1+zstd.1.5.0.
Examples
Some real world build metadata idioms drawn from crates.io:
-
libgit2-sys
0.12.20+1.1.0— for this crate, the build metadata indicates the version of the C libgit2 library that the Rust crate is built against. -
mashup
0.1.13+deprecated— just the word "deprecated" for a crate that has been superseded by another. Eventually people will take notice of this in Cargo's build output where it lists the crates being compiled. -
google-bigquery2
2.0.4+20210327— this library is automatically generated from an official API schema, and the build metadata indicates the date on which that schema was last captured. -
fbthrift-git
0.0.6+c7fcc0e— this crate is published from snapshots of a big company monorepo. In monorepo development, there is no concept of versions, and all downstream code is just updated atomically in the same commit that breaking changes to a library are landed. Therefore for crates.io purposes, every published version must be assumed to be incompatible with the previous. The build metadata provides the source control hash of the snapshotted code.
Syntax
Build metadata is a series of dot separated identifiers immediately
following the patch or pre-release version. Identifiers must comprise only
ASCII alphanumerics and hyphens: 0-9, A-Z, a-z, -. Identifiers must
not be empty. Leading zeros are allowed, unlike any other place in the
SemVer grammar.
Total ordering
Build metadata is ignored in evaluating VersionReq; it plays no role in
whether a Version matches any one of the comparison operators.
However for comparing build metadatas among one another, they do have a total order which is determined by lexicographic ordering of dot-separated components. Identifiers consisting of only digits are compared numerically. Otherwise, identifiers are compared in ASCII sort order. Any numeric identifier is always less than any non-numeric identifier.
Example: demo < demo.85 < demo.90 < demo.090 < demo.200 < demo.1a0 < demo.a < memo
Implementations
impl BuildMetadata
fn new(text: &str) -> Result<Self, Error>fn as_str(self: &Self) -> &strfn is_empty(self: &Self) -> bool
impl Clone for BuildMetadata
fn clone(self: &Self) -> BuildMetadata
impl Debug for crate::BuildMetadata
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result
impl Default for BuildMetadata
fn default() -> BuildMetadata
impl Deref for crate::BuildMetadata
fn deref(self: &Self) -> &<Self as >::Target
impl Display for crate::BuildMetadata
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for BuildMetadata
impl Freeze for BuildMetadata
impl FromStr for crate::BuildMetadata
fn from_str(text: &str) -> Result<Self, <Self as >::Err>
impl Hash for BuildMetadata
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Ord for crate::BuildMetadata
fn cmp(self: &Self, rhs: &Self) -> Ordering
impl PartialEq for BuildMetadata
fn eq(self: &Self, other: &BuildMetadata) -> bool
impl PartialOrd for crate::BuildMetadata
fn partial_cmp(self: &Self, rhs: &Self) -> Option<Ordering>
impl RefUnwindSafe for BuildMetadata
impl Send for BuildMetadata
impl StructuralPartialEq for BuildMetadata
impl Sync for BuildMetadata
impl Unpin for BuildMetadata
impl UnwindSafe for BuildMetadata
impl<P, T> Receiver for BuildMetadata
impl<T> Any for BuildMetadata
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BuildMetadata
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BuildMetadata
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for BuildMetadata
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for BuildMetadata
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for BuildMetadata
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for BuildMetadata
fn to_string(self: &Self) -> String
impl<T, U> Into for BuildMetadata
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BuildMetadata
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BuildMetadata
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>