pub struct RpcApiVersion(/* private fields */);
Methods from Deref<Target = Version>§
sourcepub fn cmp_precedence(&self, other: &Version) -> Ordering
pub fn cmp_precedence(&self, other: &Version) -> Ordering
Compare the major, minor, patch, and pre-release value of two versions, disregarding build metadata. Versions that differ only in build metadata are considered equal. This comparison is what the SemVer spec refers to as “precedence”.
§Example
use semver::Version;
let mut versions = [
"1.20.0+c144a98".parse::<Version>().unwrap(),
"1.20.0".parse().unwrap(),
"1.0.0".parse().unwrap(),
"1.0.0-alpha".parse().unwrap(),
"1.20.0+bc17664".parse().unwrap(),
];
// This is a stable sort, so it preserves the relative order of equal
// elements. The three 1.20.0 versions differ only in build metadata so
// they are not reordered relative to one another.
versions.sort_by(Version::cmp_precedence);
assert_eq!(versions, [
"1.0.0-alpha".parse().unwrap(),
"1.0.0".parse().unwrap(),
"1.20.0+c144a98".parse().unwrap(),
"1.20.0".parse().unwrap(),
"1.20.0+bc17664".parse().unwrap(),
]);
// Totally order the versions, including comparing the build metadata.
versions.sort();
assert_eq!(versions, [
"1.0.0-alpha".parse().unwrap(),
"1.0.0".parse().unwrap(),
"1.20.0".parse().unwrap(),
"1.20.0+bc17664".parse().unwrap(),
"1.20.0+c144a98".parse().unwrap(),
]);
Trait Implementations§
source§impl Clone for RpcApiVersion
impl Clone for RpcApiVersion
source§fn clone(&self) -> RpcApiVersion
fn clone(&self) -> RpcApiVersion
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RpcApiVersion
impl Debug for RpcApiVersion
source§impl Default for RpcApiVersion
impl Default for RpcApiVersion
source§fn default() -> RpcApiVersion
fn default() -> RpcApiVersion
Returns the “default value” for a type. Read more
source§impl Deref for RpcApiVersion
impl Deref for RpcApiVersion
source§impl<'de> Deserialize<'de> for RpcApiVersion
impl<'de> Deserialize<'de> for RpcApiVersion
source§fn deserialize<D>(
deserializer: D,
) -> Result<RpcApiVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<RpcApiVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for RpcApiVersion
impl PartialEq for RpcApiVersion
source§impl Serialize for RpcApiVersion
impl Serialize for RpcApiVersion
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for RpcApiVersion
impl StructuralPartialEq for RpcApiVersion
Auto Trait Implementations§
impl Freeze for RpcApiVersion
impl RefUnwindSafe for RpcApiVersion
impl Send for RpcApiVersion
impl Sync for RpcApiVersion
impl Unpin for RpcApiVersion
impl UnwindSafe for RpcApiVersion
Blanket Implementations§
source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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§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
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more