pub struct Version {
pub major: usize,
pub minor: usize,
pub patch: usize,
pub prerelease: Prerelease,
pub build_metadata: BuildMetadata,
/* private fields */
}
Expand description
A parsed version string, conforming to a specific dialect.
Instances of Version
can be compared against one another, and formatted as a string.
§Example
use smvr::{Dialect, Version};
let version = Version::parse("0.1.4-beta", Dialect::Standard);
Fields§
§major: usize
The major version number.
minor: usize
The minor version number.
patch: usize
The patch version number.
prerelease: Prerelease
The prerelease identifier, if provided.
build_metadata: BuildMetadata
The build metadata, if provided.
Implementations§
Source§impl Version
impl Version
Sourcepub fn parse(version: &str, dialect: Dialect) -> Result<Self, Error>
pub fn parse(version: &str, dialect: Dialect) -> Result<Self, Error>
Parse a string into a Version instance, following a specific Semver dialect.
use smvr::{Dialect, Version};
let version = Version::parse("0.1.4-beta", Dialect::Standard);
§Errors
If the version string is not valid for the chosen dialect, the first error encountered will be returned.
§Panics
If the version string is not valid utf-8, a panic will occur.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations§
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