forked from rust-postgres/rust-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacros.rs
More file actions
30 lines (28 loc) · 717 Bytes
/
Copy pathmacros.rs
File metadata and controls
30 lines (28 loc) · 717 Bytes
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
macro_rules! try_desync(
($s:expr, $e:expr) => (
match $e {
Ok(ok) => ok,
Err(err) => {
$s.desynchronized = true;
return Err(::std::error::FromError::from_error(err));
}
}
)
)
macro_rules! check_desync(
($e:expr) => ({
if $e.canary() != CANARY {
panic!("Connection use after free. See mozilla/rust#13246.");
}
if $e.is_desynchronized() {
return Err(::Error::StreamDesynchronized);
}
})
)
macro_rules! bad_response(
($s:expr) => ({
debug!("Unexpected response");
$s.desynchronized = true;
return Err(::Error::BadResponse);
})
)