1extern crate protobuf;
2
3use protobuf::error::ProtobufError;
4use std::io::Error as IoError;
5
6#[derive(Debug)]
7pub enum ConnectionErr {
8 NameTooLong,
9 TcpConnectionFailure(IoError),
10 HelloMessageFailed(IoError),
11 NameMessageFailed(IoError),
12 IdMessageFailed(IoError),
13 IdMessageTooShort,
14 OkMessageFailed(IoError),
15 OkMessageWrong,
16 RWCreationError(ProtobufError)
17}
18#[derive(Debug)]
19pub enum TransceiverError {
20 Protobuf(ProtobufError),
21 Socket(IoError),
22 ResponseHasError(String)
23}
24impl From<ProtobufError> for TransceiverError { fn from(i : ProtobufError) -> Self { TransceiverError::Protobuf(i) } }
25impl From<IoError> for TransceiverError { fn from(i : IoError) -> Self { TransceiverError::Socket(i) } }
26
27pub type Id = [u8; 16];
28#[macro_use]
29mod macros;
30pub mod schema;
31pub mod rpc;
32pub mod stream;
33
34#[macro_export]
35macro_rules! invoke {
36 ( $rpc : ident.$a : tt.$b : tt () ) => { $rpc.invoke(stringify!($a).to_owned(), stringify!($b).to_owned(), vec!()) };
37 ( $rpc : ident.$a : tt.$b : tt ( $( $arg : expr ),+ ) ) => {{
38 let mut args = vec!();
39 $(
40 args.push($arg);
41 )+
42 $rpc.invoke(stringify!($a).to_owned(), stringify!($b).to_owned(), args)
43 }}
44}