pub struct State<'a> {
pub dirty: bool,
pub last_update: BTreeMap<String, Timestamp>,
pub once: BTreeMap<String, Timestamp>,
pub hashes: BTreeMap<String, Hashed>,
pub config: &'a Config,
pub now: Timestamp,
}
Expand description
State model. This keeps track of any changes with the dirty flag, which is an indication whether it should be serialized or not.
Fields§
§dirty: bool
§last_update: BTreeMap<String, Timestamp>
Last time git was updated.
once: BTreeMap<String, Timestamp>
Things that should only happen once.
hashes: BTreeMap<String, Hashed>
Things that have been tested against a hash.
config: &'a Config
The current configuration.
now: Timestamp
Current timestamp.
Implementations§
source§impl<'a> State<'a>
impl<'a> State<'a>
pub fn new(config: &'a Config, now: Timestamp) -> Self
sourcepub fn last_update<'time>(&'time self, name: &str) -> Option<&'time Timestamp>
pub fn last_update<'time>(&'time self, name: &str) -> Option<&'time Timestamp>
Get the last update timestamp for the given thing named name
.
sourcepub fn has_run_once(&self, id: &str) -> bool
pub fn has_run_once(&self, id: &str) -> bool
Check if the given ID has run once.
sourcepub fn touch_once(&mut self, id: &str)
pub fn touch_once(&mut self, id: &str)
Mark that something has happened once.
sourcepub fn is_hash_fresh<H: Hash>(&self, id: &str, hash: H) -> Result<bool, Error>
pub fn is_hash_fresh<H: Hash>(&self, id: &str, hash: H) -> Result<bool, Error>
Touch the hashed item.
Trait Implementations§
source§impl<'a> PartialEq<State<'a>> for State<'a>
impl<'a> PartialEq<State<'a>> for State<'a>
impl<'a> Eq for State<'a>
impl<'a> StructuralEq for State<'a>
impl<'a> StructuralPartialEq for State<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for State<'a>
impl<'a> Send for State<'a>
impl<'a> Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> UnwindSafe for State<'a>
Blanket Implementations§
source§impl<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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.