Skip to main content

EvalContext

Struct EvalContext 

Source
pub struct EvalContext<'a> {
    pub seen_before: Option<&'a dyn Fn(&str) -> bool>,
}
Expand description

Caller-supplied runtime context for evaluate_plan.

Evaluation stays synchronous and I/O-free: instead of the engine touching storage, callers hand in an optional seen_before predicate that decides whether an automated reply was already sent to a sender within its respond period.

Fields§

§seen_before: Option<&'a dyn Fn(&str) -> bool>

Respond-once hook for the vacation action (RFC 5230): return true when a reply was already sent to this sender within the configured period. When None, no dedup is applied and the outcome always carries the reply (hosts can dedup themselves using the to/days fields of VacationReply, or use the ready-made VacationTracker).

Implementations§

Source§

impl<'a> EvalContext<'a>

Source

pub fn with_seen_before(self, seen_before: &'a dyn Fn(&str) -> bool) -> Self

Attach a respond-once dedup predicate.

Trait Implementations§

Source§

impl<'a> Default for EvalContext<'a>

Source§

fn default() -> EvalContext<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EvalContext<'a>

§

impl<'a> !Send for EvalContext<'a>

§

impl<'a> !Sync for EvalContext<'a>

§

impl<'a> !UnwindSafe for EvalContext<'a>

§

impl<'a> Freeze for EvalContext<'a>

§

impl<'a> Unpin for EvalContext<'a>

§

impl<'a> UnsafeUnpin for EvalContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.