diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-11-18 20:25:04 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-11-18 20:25:04 +0100 |
commit | 028af389a037a6edc0ff5b26e34abde9ecc1042c (patch) | |
tree | ace7f78d5fa781caf54cdae3b33282707c6f789c /src/event.rs | |
parent | 14bf5eb9e56de631d6dc2e47d6023c742c14b7e2 (diff) | |
download | evtclib-028af389a037a6edc0ff5b26e34abde9ecc1042c.tar.gz evtclib-028af389a037a6edc0ff5b26e34abde9ecc1042c.tar.bz2 evtclib-028af389a037a6edc0ff5b26e34abde9ecc1042c.zip |
make EventKind non-exhaustive
There are two reasons for this:
First, we want to implement new events (and arcdps might add new events
themselves) without having to release a new major version. Adding enum
variants is usually a breaking change, because match blocks have to be
adjusted to keep every variant included. This is the same reason why we
made Encounter and Boss non-exhaustive as well.
Secondly, the usual modus operandi is not to iterate through all events
and do something for every event kind that you find, but rather to
iterate through the events and look for the events that you find
interesting. This means that most often, you will use a match with a
"do-nothing" catch-all, an if-let or a matches!() anyway, in which case
this change does not affect the code in a good or bad way.
Diffstat (limited to 'src/event.rs')
-rw-r--r-- | src/event.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/event.rs b/src/event.rs index ee561f8..0ba56ab 100644 --- a/src/event.rs +++ b/src/event.rs @@ -32,6 +32,7 @@ pub enum FromRawEventError { /// This makes dealing with [`CbtEvent`][raw::CbtEvent] a bit saner (and safer). #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq)] +#[non_exhaustive] pub enum EventKind { // State change events /// The agent has entered combat. |