Struct quickcfg::State

source ·
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>

source

pub fn new(config: &'a Config, now: Timestamp) -> Self

source

pub fn last_update<'time>(&'time self, name: &str) -> Option<&'time Timestamp>

Get the last update timestamp for the given thing named name.

source

pub fn touch(&mut self, name: &str)

Touch the thing with the given name.

source

pub fn has_run_once(&self, id: &str) -> bool

Check if the given ID has run once.

source

pub fn touch_once(&mut self, id: &str)

Mark that something has happened once.

source

pub fn is_hash_fresh<H: Hash>(&self, id: &str, hash: H) -> Result<bool, Error>

Touch the hashed item.

source

pub fn touch_hash<H: Hash>(&mut self, id: &str, hash: H) -> Result<(), Error>

Touch the hashed item.

source

pub fn extend(&mut self, other: State<'_>)

Extend this state with another.

source

pub fn serialize(self) -> Option<DiskState>

Serialize the state, returning None unless it is dirty.

Trait Implementations§

source§

impl<'a> Debug for State<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq<State<'a>> for State<'a>

source§

fn eq(&self, other: &State<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for State<'a>

source§

impl<'a> StructuralEq for State<'a>

source§

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<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more