pub struct Version { /* private fields */ }
Expand description
A simple representation of a version string. For semantic versioning Steve Klabnik’s semver crate is preferable. But non-semantic versioning is also permitted in this struct.
Implementations§
Source§impl Version
impl Version
Sourcepub fn get_representation(self) -> String
pub fn get_representation(self) -> String
Get the string representation of the version
Sourcepub fn set_representation(&mut self, val: String)
pub fn set_representation(&mut self, val: String)
Change the version along with checking if this new version appears to be semantic
Sourcepub fn is_semantic(representation: &str) -> bool
pub fn is_semantic(representation: &str) -> bool
Check if a representation appears to be semantic versioning
Sourcepub fn set_semantic(&mut self, val: bool) -> Result<(), Error>
pub fn set_semantic(&mut self, val: bool) -> Result<(), Error>
Explicitly set whether the version is semantic. If the version string doesn’t pass is_semantic, then it won’t set semantic to true and will return false.
Sourcepub fn get_semantic(self) -> bool
pub fn get_semantic(self) -> bool
Is this a semantic version?
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