Browse Source

more from case study

master
Jonathan Strong 4 years ago
parent
commit
304d2ce9de
1 changed files with 23 additions and 0 deletions
  1. +23
    -0
      src/case_study.rs

+ 23
- 0
src/case_study.rs View File

@@ -113,6 +113,29 @@ impl Active {
event_attr!(id, Uuid, id); event_attr!(id, Uuid, id);
} }



impl From<Event<Pending>> for Active {
fn from(pending: Event<Pending>) -> Active {
Active::Pending(pending)
}
}

macro_rules! from_event {
($t:ty, $variant:ident) => {
impl From<Event<$t>> for Active {
fn from(event: Event<$t>) -> Active {
Active::$variant(event)
}
}
}
}

//from_event!(Pending, Pending);
from_event!(Sending, Sending);
from_event!(Sent, Sent);
from_event!(Ack, Acked);
from_event!(Finished<Sent>, FinishedNoAck);

#[allow(unused)] #[allow(unused)]
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {


Loading…
Cancel
Save