pub enum SchemaVersion {
Version(NonZeroU32),
Latest,
}
Expand description
The schema version
A schema version could be a number in [1, 2^31-1], or the ‘latest’ version.
You can build a schema version from a string
let version = "2".parse::<SchemaVersion>().unwrap();
let latest1 = "latest".parse::<SchemaVersion>().unwrap();
let latest2 = "-1".parse::<SchemaVersion>().unwrap();
assert_eq!(latest1, latest2);
Note that version could not start with 0
let result = "0".parse::<SchemaVersion>(); // 🚨 Error
assert!(result.is_err());
Variants§
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<'de> Deserialize<'de> for SchemaVersion
impl<'de> Deserialize<'de> for SchemaVersion
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SchemaVersion
impl Display for SchemaVersion
Source§impl FromStr for SchemaVersion
impl FromStr for SchemaVersion
Source§impl Hash for SchemaVersion
impl Hash 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
Source§impl Serialize for SchemaVersion
impl Serialize for SchemaVersion
impl Copy 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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.