#[repr(C)]pub struct MajorMinor {
pub major: u16,
pub minor: u16,
}
Expand description
A type representing a major, minor version pair.
This is not part of the spec, but versions in the spec are frequently
represented as a major_version
, minor_version
pair. This type encodes
those as a single type, which is useful for some of the generated code that
parses out a version.
Fields§
§major: u16
The major version number
minor: u16
The minor version number
Implementations§
Source§impl MajorMinor
impl MajorMinor
Sourcepub const VERSION_1_0: MajorMinor = _
pub const VERSION_1_0: MajorMinor = _
Version 1.0
Sourcepub const VERSION_1_1: MajorMinor = _
pub const VERSION_1_1: MajorMinor = _
Version 1.1
Sourcepub const VERSION_1_2: MajorMinor = _
pub const VERSION_1_2: MajorMinor = _
Version 1.2
Sourcepub const VERSION_1_3: MajorMinor = _
pub const VERSION_1_3: MajorMinor = _
Version 1.3
Sourcepub const VERSION_2_0: MajorMinor = _
pub const VERSION_2_0: MajorMinor = _
Version 2.0
Sourcepub const fn new(major: u16, minor: u16) -> Self
pub const fn new(major: u16, minor: u16) -> Self
Create a new version with major and minor parts.
Sourcepub const fn to_be_bytes(self) -> [u8; 4]
pub const fn to_be_bytes(self) -> [u8; 4]
The representation of this version as a big-endian byte array.
Trait Implementations§
Source§impl Clone for MajorMinor
impl Clone for MajorMinor
Source§fn clone(&self) -> MajorMinor
fn clone(&self) -> MajorMinor
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 Compatible<(u16, u16)> for MajorMinor
impl Compatible<(u16, u16)> for MajorMinor
Source§impl Compatible for MajorMinor
impl Compatible for MajorMinor
Source§fn compatible(&self, other: Self) -> bool
fn compatible(&self, other: Self) -> bool
Source§impl Debug for MajorMinor
impl Debug for MajorMinor
Source§impl Default for MajorMinor
impl Default for MajorMinor
Source§fn default() -> MajorMinor
fn default() -> MajorMinor
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MajorMinor
impl<'de> Deserialize<'de> for MajorMinor
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 MajorMinor
impl Display for MajorMinor
Source§impl Hash for MajorMinor
impl Hash for MajorMinor
Source§impl Ord for MajorMinor
impl Ord for MajorMinor
Source§fn cmp(&self, other: &MajorMinor) -> Ordering
fn cmp(&self, other: &MajorMinor) -> 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 MajorMinor
impl PartialEq for MajorMinor
Source§impl PartialOrd for MajorMinor
impl PartialOrd for MajorMinor
Source§impl Scalar for MajorMinor
impl Scalar for MajorMinor
Source§impl Serialize for MajorMinor
impl Serialize for MajorMinor
impl AnyBitPattern for MajorMinor
impl Copy for MajorMinor
impl Eq for MajorMinor
impl StructuralPartialEq for MajorMinor
Auto Trait Implementations§
impl Freeze for MajorMinor
impl RefUnwindSafe for MajorMinor
impl Send for MajorMinor
impl Sync for MajorMinor
impl Unpin for MajorMinor
impl UnwindSafe for MajorMinor
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FixedSize for Twhere
T: Scalar,
impl<T> FixedSize for Twhere
T: Scalar,
Source§const RAW_BYTE_LEN: usize = const RAW_BYTE_LEN: usize = std::mem::size_of::<T::Raw>();
const RAW_BYTE_LEN: usize = const RAW_BYTE_LEN: usize = std::mem::size_of::<T::Raw>();
The raw size of this type, in bytes. Read more