1#[derive(Default)]
7pub struct UpdateState {
8 pub(in crate::app) available: Option<String>,
10 pub(in crate::app) headline: Option<String>,
12 pub(in crate::app) hint: &'static str,
14}
15
16impl UpdateState {
17 pub fn with_current_hint() -> Self {
19 Self {
20 hint: crate::update::update_hint(),
21 ..Self::default()
22 }
23 }
24
25 pub fn available(&self) -> Option<&String> {
26 self.available.as_ref()
27 }
28
29 pub fn headline(&self) -> Option<&str> {
30 self.headline.as_deref()
31 }
32
33 pub fn hint(&self) -> &'static str {
34 self.hint
35 }
36
37 pub fn announce(&mut self, version: String, headline: Option<String>) {
38 self.available = Some(version);
39 self.headline = headline;
40 }
41}