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§
impl<'a> Eq for State<'a>
impl<'a> StructuralPartialEq for State<'a>
Auto Trait Implementations§
impl<'a> Freeze for State<'a>
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<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
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
Compare self to
key
and return true
if they are equal.