1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
extern crate bincode;
extern crate rustc_serialize;
extern crate vec_map;

use std::io::Error as IoError;
use bincode::rustc_serialize::{EncodingError, DecodingError};
pub use network::{Sender, Receiver};

pub mod msgqueue;
pub mod network;

pub type UnrResult<T> = Result<T, UnrError>;

#[derive(Debug)]
pub enum UnrError {
    IoError(IoError),
    EncodingError(EncodingError),
    DecodingError(DecodingError)
}

impl From<IoError> for UnrError {
    fn from(ioe: IoError) -> UnrError {
        UnrError::IoError(ioe)
    }
}

impl From<EncodingError> for UnrError {
    fn from(e: EncodingError) -> UnrError {
        UnrError::EncodingError(e)
    }
}

impl From<DecodingError> for UnrError {
    fn from(e: DecodingError) -> UnrError {
        UnrError::DecodingError(e)
    }
}