Struct foca::AccumulatingRuntime
source · pub struct AccumulatingRuntime<T> { /* private fields */ }
Expand description
A Runtime
implementation that’s good enough for simple use-cases.
It accumulates all events that happen during an interaction with
crate::Foca
and users must drain those and react accordingly.
Better runtimes would react directly to the events, intead of needlessly storing the events in a queue.
Users must drain the runtime immediately after interacting with foca. Example:
See it in use at examples/foca_insecure_udp_agent.rs
Implementations§
source§impl<T> AccumulatingRuntime<T>
impl<T> AccumulatingRuntime<T>
sourcepub fn to_send(&mut self) -> Option<(T, Bytes)>
pub fn to_send(&mut self) -> Option<(T, Bytes)>
Yields data to be sent to a cluster member T
in the
order they’ve happened.
Users are expected to drain it until it yields None
after every interaction with crate::Foca
sourcepub fn to_schedule(&mut self) -> Option<(Duration, Timer<T>)>
pub fn to_schedule(&mut self) -> Option<(Duration, Timer<T>)>
Yields timer events and how far in the future they must be given back to the foca instance that produced it
Users are expected to drain it until it yields None
after every interaction with crate::Foca
sourcepub fn to_notify(&mut self) -> Option<Notification<T>>
pub fn to_notify(&mut self) -> Option<Notification<T>>
Yields event notifications in the order they’ve happened
Users are expected to drain it until it yields None
after every interaction with crate::Foca