pub trait ReactionTrigger<T> {
// Required methods
fn get_value(&self, now: &EventTag, start: &Instant) -> Option<T>
where T: Copy;
fn use_value_ref<O>(
&self,
now: &EventTag,
start: &Instant,
action: impl FnOnce(Option<&T>) -> O,
) -> O;
// Provided method
fn is_present(&self, now: &EventTag, start: &Instant) -> bool { ... }
}Expand description
Common trait for actions, ports, and timer objects handed to reaction functions. This is meant to be used through the API of ReactionCtx instead of directly.
Required Methods§
Sourcefn get_value(&self, now: &EventTag, start: &Instant) -> Option<T>where
T: Copy,
fn get_value(&self, now: &EventTag, start: &Instant) -> Option<T>where
T: Copy,
Copies the value out, if it is present. Whether a value is present is not in general the same thing as whether this trigger Self::is_present. See crate::ReactionCtx::get.
Provided Methods§
Sourcefn is_present(&self, now: &EventTag, start: &Instant) -> bool
fn is_present(&self, now: &EventTag, start: &Instant) -> bool
Returns whether the trigger is present, given that the current logical time is the parameter.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.