pub struct StreamRuleLedger {
pub turn: u64,
pub fired: BTreeMap<String, u64>,
}Expand description
User-turn counter plus the turn each stream rule last fired on.
Fields§
§turn: u64User turns started in this session (1-based once a turn runs).
fired: BTreeMap<String, u64>Rule name → turn of its last hit.
Implementations§
Source§impl StreamRuleLedger
impl StreamRuleLedger
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Nothing fired yet (the turn counter alone is not worth persisting).
Sourcepub fn begin_turn(&mut self)
pub fn begin_turn(&mut self)
A new user turn starts.
Sourcepub fn last_fired(&self, name: &str) -> Option<u64>
pub fn last_fired(&self, name: &str) -> Option<u64>
Turn on which name last fired.
Trait Implementations§
Source§impl Clone for StreamRuleLedger
impl Clone for StreamRuleLedger
Source§impl Debug for StreamRuleLedger
impl Debug for StreamRuleLedger
Source§impl Default for StreamRuleLedger
impl Default for StreamRuleLedger
Source§impl<'de> Deserialize<'de> for StreamRuleLedger
impl<'de> Deserialize<'de> for StreamRuleLedger
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for StreamRuleLedger
Source§impl PartialEq for StreamRuleLedger
impl PartialEq for StreamRuleLedger
Source§impl Serialize for StreamRuleLedger
impl Serialize for StreamRuleLedger
impl StructuralPartialEq for StreamRuleLedger
Auto Trait Implementations§
impl Freeze for StreamRuleLedger
impl RefUnwindSafe for StreamRuleLedger
impl Send for StreamRuleLedger
impl Sync for StreamRuleLedger
impl Unpin for StreamRuleLedger
impl UnsafeUnpin for StreamRuleLedger
impl UnwindSafe for StreamRuleLedger
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<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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more