aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
blob: f9a04223f0189497a23473fbc9cb5303e2bb1cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::borrow::{ Borrow, ToOwned };

use command;
use reply;

#[derive(Debug, Clone, PartialEq)]
pub enum Event<'a> {
    Command(command::Command<'a>),
    Reply(reply::Reply<'a>),
    Connected,
    Disconnected
}

impl<'a> Event<'a> {
    pub fn to_static(&self) -> Event<'static> {
        use Event::*;
        match self {
            &Command(ref c) => Command(c.to_static()),
            &Reply(ref r) => Reply(r.to_static()),
            &Connected => Connected,
            &Disconnected => Disconnected
        }
    }
}