Struct mitrid_core::utils::version::Version [−][src]
pub struct Version { pub major: u32, pub minor: u32, pub patch: u32, pub prerelease: String, pub buildmeta: String, }
Type used to represent a Semver version.
Fields
major: u32
Semver version major. Used for API breaking changes.
minor: u32
Semver version minor. Used for backward-compatible API changes.
patch: u32
Semver version patch. Used for changes not affecting the API.
prerelease: String
Semver version prerelease. Used in prereleases. Optional.
buildmeta: String
Semver version buildmeta. Build information. Optional.
Methods
impl Version
[src]
impl Version
pub fn new(
major: u32,
minor: u32,
patch: u32,
pre: &str,
build: &str
) -> Result<Version>
[src]
pub fn new(
major: u32,
minor: u32,
patch: u32,
pre: &str,
build: &str
) -> Result<Version>
Creates a new Semver version.
pub fn check_numeric(num: &str) -> Result<()>
[src]
pub fn check_numeric(num: &str) -> Result<()>
Check a Semver numeric version (major, minor or patch).
pub fn check_prerelease(pre: &str) -> Result<()>
[src]
pub fn check_prerelease(pre: &str) -> Result<()>
Check a Semver prerelease version.
pub fn check_buildmeta(build: &str) -> Result<()>
[src]
pub fn check_buildmeta(build: &str) -> Result<()>
Check a buildmeta prerelease version.
pub fn check_semver(sv: &str) -> Result<()>
[src]
pub fn check_semver(sv: &str) -> Result<()>
Check a semver version.
pub fn parse(s: &str) -> Result<Version>
[src]
pub fn parse(s: &str) -> Result<Version>
Parse a string as a Version
.
pub fn to_string(&self) -> String
[src]
pub fn to_string(&self) -> String
Stringify the Version
.
pub fn is_compatible(&self, other: &Version) -> Result<bool>
[src]
pub fn is_compatible(&self, other: &Version) -> Result<bool>
Returns if this Version
is compatible to an other.
Trait Implementations
impl Clone for Version
[src]
impl Clone for Version
fn clone(&self) -> Version
[src]
fn clone(&self) -> Version
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Version
[src]
impl Debug for Version
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for Version
[src]
impl Hash for Version
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for Version
[src]
impl Default for Version
impl PartialEq for Version
[src]
impl PartialEq for Version
fn eq(&self, other: &Version) -> bool
[src]
fn eq(&self, other: &Version) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Version
[src]
impl Eq for Version
impl Display for Version
[src]
impl Display for Version
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialOrd for Version
[src]
impl PartialOrd for Version
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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
impl Ord for Version
[src]
impl Ord for Version
fn cmp(&self, other: &Version) -> Ordering
[src]
fn cmp(&self, other: &Version) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Sizable for Version
[src]
impl Sizable for Version
impl Checkable for Version
[src]
impl Checkable for Version
fn check(&self) -> Result<()>
[src]
fn check(&self) -> Result<()>
Checks the implementor.
fn check_async(&self) -> Future<()>
[src]
fn check_async(&self) -> Future<()>
Check asynchronously the implementor.
impl Datable for Version
[src]
impl Datable for Version
impl Serializable for Version
[src]
impl Serializable for Version
fn to_json(&self) -> Result<String>
[src]
fn to_json(&self) -> Result<String>
Serializes the implementor into a json string.
fn from_json(s: &str) -> Result<Self>
[src]
fn from_json(s: &str) -> Result<Self>
Deserializes a json string into the implementor type.
fn to_bytes(&self) -> Result<Vec<u8>>
[src]
fn to_bytes(&self) -> Result<Vec<u8>>
Serializes the implementor into a byte vector.
fn from_bytes(b: &[u8]) -> Result<Self>
[src]
fn from_bytes(b: &[u8]) -> Result<Self>
Deserializes a byte vector into the implementor type.
fn to_hex(&self) -> Result<String>
[src]
fn to_hex(&self) -> Result<String>
Serializes the implementor into a hex string.
fn from_hex(s: &str) -> Result<Self>
[src]
fn from_hex(s: &str) -> Result<Self>
Deserializes an hex string into the implementor type.