From 028af389a037a6edc0ff5b26e34abde9ecc1042c Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 18 Nov 2021 20:25:04 +0100 Subject: 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. --- src/event.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src') 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. -- cgit v1.2.3