Struct lpc55::secure_binary::Version
source · [−]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: u16
Implementations
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
sourcefn 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
sourceimpl Ord for Version
impl Ord for Version
1.21.0 · sourcefn 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
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Version> for Version
impl PartialOrd<Version> for Version
sourcefn partial_cmp(&self, other: &Version) -> Option<Ordering>
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Version
impl Eq for Version
impl StructuralEq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.