pub struct UpdateState {
pub checked_at: u64,
pub latest: Option<Release>,
pub skipped: Option<String>,
pub advisories: Vec<Advisory>,
}Expand description
What is kept between runs (<data dir>/updates.json): when the host was
last asked, what it said, and the version the user chose to skip.
Fields§
§checked_at: u64Unix seconds of the last attempt, successful or not.
latest: Option<Release>The newest release found, kept for later runs: the chip needs no
request to say “available” again. Compared with the running version
every time it is read (UpdateState::available).
skipped: Option<String>The version the user chose to skip: no chip for it, a newer one shows.
advisories: Vec<Advisory>The security notices of the last check whose signature held (every
notice, not only the ones that name this build: the running version
is compared when they are read). Kept like latest, so the chip needs
no request.
Implementations§
Source§impl UpdateState
impl UpdateState
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes the file, creating its folder. Best effort for the caller: losing it only means one more check.
Sourcepub fn due(&self, now: u64, force: bool) -> bool
pub fn due(&self, now: u64, force: bool) -> bool
Whether a check is due: never done, or a day old. force (the
palette’s “Check for updates now”) ignores the throttle.
Sourcepub fn available(
&self,
running: &str,
channel: UpdateChannel,
) -> Option<Release>
pub fn available( &self, running: &str, channel: UpdateChannel, ) -> Option<Release>
The kept release when it is still newer than running, in channel,
and not the skipped one.
Trait Implementations§
Source§impl Clone for UpdateState
impl Clone for UpdateState
Source§impl Debug for UpdateState
impl Debug for UpdateState
Source§impl Default for UpdateState
impl Default for UpdateState
Source§impl<'de> Deserialize<'de> for UpdateState
impl<'de> Deserialize<'de> for UpdateState
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>,
impl Eq for UpdateState
Source§impl PartialEq for UpdateState
impl PartialEq for UpdateState
Source§impl Serialize for UpdateState
impl Serialize for UpdateState
impl StructuralPartialEq for UpdateState
Auto Trait Implementations§
impl Forget for UpdateState
impl Freeze for UpdateState
impl Move for UpdateState
impl RefUnwindSafe for UpdateState
impl Send for UpdateState
impl Sync for UpdateState
impl Unpin for UpdateState
impl UnsafeUnpin for UpdateState
impl UnwindSafe for UpdateState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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§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
key and return true if they are equal.