pub struct VacationTracker { /* private fields */ }Expand description
In-memory ledger for vacation respond-once-per-sender-per-period
semantics (RFC 5230). Record a reply when one is sent; query with
seen_before to decide whether another is due.
Thread-safe; usable directly as an
EvalContext::seen_before predicate.
use sieve_kit::actions::VacationTracker;
let tracker = VacationTracker::new();
assert!(!tracker.seen_before("alice@example.com", 7));
tracker.record("alice@example.com");
assert!(tracker.seen_before("alice@example.com", 7));
assert!(!tracker.seen_before("bob@example.com", 7));Implementations§
Source§impl VacationTracker
impl VacationTracker
Sourcepub fn seen_before(&self, sender: &str, days: u32) -> bool
pub fn seen_before(&self, sender: &str, days: u32) -> bool
Whether a reply was recorded for sender less than days days ago.
Poisoned state is treated as “nothing recorded” (never panics).
Trait Implementations§
Source§impl Default for VacationTracker
impl Default for VacationTracker
Source§fn default() -> VacationTracker
fn default() -> VacationTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for VacationTracker
impl RefUnwindSafe for VacationTracker
impl Send for VacationTracker
impl Sync for VacationTracker
impl Unpin for VacationTracker
impl UnsafeUnpin for VacationTracker
impl UnwindSafe for VacationTracker
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