Skip to main content

wowlab_engine_combat/state/runtime/
events.rs

1use super::{CombatInstance, Event, SpecRuntimeError};
2
3impl CombatInstance {
4    #[inline]
5    pub fn schedule(&mut self, event: Event) {
6        self.runtime.pending_events.push(event);
7    }
8
9    #[inline]
10    pub fn drain_events(&mut self) -> std::vec::Drain<'_, Event> {
11        self.runtime.pending_events.drain(..)
12    }
13
14    pub(crate) fn record_runtime_error(&mut self, error: SpecRuntimeError) {
15        if self.runtime.runtime_error.is_none() {
16            self.runtime.runtime_error = Some(error);
17        }
18    }
19
20    #[must_use]
21    pub(crate) const fn has_runtime_error(&self) -> bool {
22        self.runtime.runtime_error.is_some()
23    }
24
25    pub(crate) fn take_runtime_error(&mut self) -> Option<SpecRuntimeError> {
26        self.runtime.runtime_error.take()
27    }
28}