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 Versionpub 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) -> StringStringify 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 Versionfn clone(&self) -> Version[src]
fn clone(&self) -> VersionReturns 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 Versionfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Hash for Version[src]
impl Hash for Versionfn 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 Versionimpl PartialEq for Version[src]
impl PartialEq for Versionfn eq(&self, other: &Version) -> bool[src]
fn eq(&self, other: &Version) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl Eq for Version[src]
impl Eq for Versionimpl Display for Version[src]
impl Display for Versionfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialOrd for Version[src]
impl PartialOrd for Versionfn 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) -> bool1.0.0[src]
fn lt(&self, other: &Rhs) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
fn le(&self, other: &Rhs) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
fn gt(&self, other: &Rhs) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
fn ge(&self, other: &Rhs) -> boolThis 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 Versionfn cmp(&self, other: &Version) -> Ordering[src]
fn cmp(&self, other: &Version) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl Sizable for Version[src]
impl Sizable for Versionimpl Checkable for Version[src]
impl Checkable for Versionfn 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 Versionimpl Serializable for Version[src]
impl Serializable for Versionfn 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.