about summary refs log tree commit diff
path: root/finito-door/src/lib.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-09-26T16·43+0200
committerVincent Ambo <mail@tazj.in>2018-09-26T16·43+0200
commit6254d056204b41b346367f9f03a4407b6c2a1a1a (patch)
tree6e17c2bb6a85ae99f4a2446d53ba2f45a8f85c41 /finito-door/src/lib.rs
parent6e35c083bf95b3793c7b1800eae4357543fec363 (diff)
feat(door): Add serde instances for door FSM types
Diffstat (limited to 'finito-door/src/lib.rs')
-rw-r--r--finito-door/src/lib.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/finito-door/src/lib.rs b/finito-door/src/lib.rs
index 296ce72b26d6..074556c76148 100644
--- a/finito-door/src/lib.rs
+++ b/finito-door/src/lib.rs
@@ -71,6 +71,7 @@
 //!
 //! Alright, enough foreplay, lets dive in!
 
+#[macro_use] extern crate serde_derive;
 extern crate finito;
 
 use finito::FSM;
@@ -89,7 +90,7 @@ type Attempts = usize;
 ///
 /// This type is the one for which `finito::FSM` will be implemented, making it
 /// the wooden (?) heart of our door.
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
 pub enum DoorState {
     /// In `Opened` state, the door is wide open and anyone who fits through can
     /// go through.
@@ -114,7 +115,7 @@ pub enum DoorState {
 
 /// This type represents the events that can occur in our door, i.e. the input
 /// and interactions it receives.
-#[derive(Debug)]
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
 pub enum DoorEvent {
     /// `Open` means someone is opening the door!
     Open,
@@ -136,7 +137,7 @@ pub enum DoorEvent {
 /// **Note**: This type by itself *is not* a collection of side-effects, it
 /// merely describes the side-effects we want to occur (which are then
 /// interpreted by the machinery later).
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
 pub enum DoorAction {
     /// `NotifyIRC` is used to display some kind of message on the
     /// aforementioned IRC channel that is, for some reason, very interested in