pub struct Version {
pub major: u16,
pub minor: u16,
pub patch: u16,
}Expand description
Version of a firmware.
The version must be encoded in certain places. To make the API somewhat useable (but admittedly also a bit weirder), we use:
- 10 bits for major
- 16 bits for minor
- 6 bits for patch
which gives offsets of 22 bits for major and 6 bits for minor in the u32.
Further, the minor version is at times interpreted as a “calver” encoding days since 2020-01-01. This is optional to use, “semver” works as well.
Fields§
§major: u16§minor: u16§patch: u16Implementations§
Source§impl Version
impl Version
Sourcepub fn minor_as_date(&self) -> NaiveDate
pub fn minor_as_date(&self) -> NaiveDate
The minor version component in its interpretation as days since 2020-01-01
pub fn timestamp_micros(&self) -> u64
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
Source§fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Version
impl Ord for Version
Source§impl PartialOrd for Version
impl PartialOrd for Version
impl Copy for Version
impl Eq for Version
impl StructuralPartialEq for Version
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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