pub struct SchemaVersion(Version);
Expand description
The schema version of a type
A SchemaVersion
wraps a semver::Version
, which means that the tracked version should follow semver.
However, for backwards compatibility reasons it is possible to initialize a SchemaVersion
using a non-semver compatible string, if it can be parsed to a single u64
(e.g. "1"
).
§Examples
use std::str::FromStr;
use alpm_types::SchemaVersion;
// create SchemaVersion from str
let version_one = SchemaVersion::from_str("1.0.0").unwrap();
let version_also_one = SchemaVersion::from_str("1").unwrap();
assert_eq!(version_one, version_also_one);
// format as String
assert_eq!("1.0.0", format!("{}", version_one));
assert_eq!("1.0.0", format!("{}", version_also_one));
Tuple Fields§
§0: Version
Implementations§
source§impl SchemaVersion
impl SchemaVersion
sourcepub fn new(version: SemverVersion) -> Self
pub fn new(version: SemverVersion) -> Self
Create a new SchemaVersion
sourcepub fn inner(&self) -> &SemverVersion
pub fn inner(&self) -> &SemverVersion
Return a reference to the inner type
Trait Implementations§
source§impl Clone for SchemaVersion
impl Clone for SchemaVersion
source§fn clone(&self) -> SchemaVersion
fn clone(&self) -> SchemaVersion
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 SchemaVersion
impl Debug for SchemaVersion
source§impl Display for SchemaVersion
impl Display for SchemaVersion
source§impl FromStr for SchemaVersion
impl FromStr for SchemaVersion
source§impl Ord for SchemaVersion
impl Ord for SchemaVersion
source§fn cmp(&self, other: &SchemaVersion) -> Ordering
fn cmp(&self, other: &SchemaVersion) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for SchemaVersion
impl PartialEq for SchemaVersion
source§impl PartialOrd for SchemaVersion
impl PartialOrd for SchemaVersion
impl Eq for SchemaVersion
impl StructuralPartialEq for SchemaVersion
Auto Trait Implementations§
impl Freeze for SchemaVersion
impl RefUnwindSafe for SchemaVersion
impl Send for SchemaVersion
impl Sync for SchemaVersion
impl Unpin for SchemaVersion
impl UnwindSafe for SchemaVersion
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
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
)