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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
extern crate atoi;
extern crate base64;
extern crate bit_vec;
#[macro_use]
extern crate bitflags;
extern crate byteorder;
extern crate checked;
pub extern crate chrono;
#[macro_use]
extern crate lazy_static;
extern crate num_bigint;
extern crate rand;
extern crate regex;
#[cfg(feature = "rustc_serialize")]
pub extern crate rustc_serialize;
pub extern crate serde;
pub extern crate serde_json;
extern crate sha1;
extern crate sha2;
extern crate smallvec;
pub extern crate time;
extern crate twox_hash;
pub extern crate uuid;
#[macro_export]
macro_rules! params {
($($name:expr => $value:expr),*) => (
vec![
$((::std::string::String::from($name), $crate::value::Value::from($value))),*
]
);
($($name:expr => $value:expr),*,) => (
params!($($name => $value),*)
);
}
macro_rules! split_at_or_err {
($reader:expr, $at:expr, $msg:expr) => {
if $reader.len() >= $at {
Ok($reader.split_at($at))
} else {
Err(io::Error::new(io::ErrorKind::UnexpectedEof, $msg))
}
};
}
#[macro_export]
macro_rules! read_lenenc_str {
($reader:expr) => {
$reader.read_lenenc_int().and_then(|len| {
let (value, rest) = split_at_or_err!(
$reader,
len as usize,
"EOF while reading length-encoded string"
)?;
*$reader = rest;
Ok(value)
})
};
}
pub mod constants;
pub mod crypto;
pub mod io;
pub mod named_params;
#[macro_use]
pub mod packets;
pub mod params;
pub mod row;
pub mod scramble;
pub mod value;