pub trait EventEvaluator<S: State>:
Display
+ Send
+ Sync{
// Required methods
fn eval(&self, state: &S, almanac: Arc<Almanac>) -> Result<f64, EventError>;
fn eval_string(
&self,
state: &S,
almanac: Arc<Almanac>,
) -> Result<String, EventError>;
fn epoch_precision(&self) -> Duration;
fn value_precision(&self) -> f64;
// Provided method
fn eval_crossing(
&self,
prev_state: &S,
next_state: &S,
almanac: Arc<Almanac>,
) -> Result<bool, EventError> { ... }
}
Expand description
A trait to specify how a specific event must be evaluated.
Required Methods§
sourcefn eval(&self, state: &S, almanac: Arc<Almanac>) -> Result<f64, EventError>
fn eval(&self, state: &S, almanac: Arc<Almanac>) -> Result<f64, EventError>
Evaluation of the event, must return a value corresponding to whether the state is before or after the event
sourcefn eval_string(
&self,
state: &S,
almanac: Arc<Almanac>,
) -> Result<String, EventError>
fn eval_string( &self, state: &S, almanac: Arc<Almanac>, ) -> Result<String, EventError>
Returns a string representation of the event evaluation for the given state