-
-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathmacros.rs
More file actions
29 lines (27 loc) · 696 Bytes
/
Copy pathmacros.rs
File metadata and controls
29 lines (27 loc) · 696 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
macro_rules! take_url {
($url:ident) => {
match $url.take() {
Some(url) => url,
None => {
return Poll::Ready(Err(Error::builder("URL already taken in Pending::Request")))
}
}
};
}
macro_rules! take_err {
($err:ident) => {
match $err.take() {
Some(err) => err,
None => Error::builder("Error already taken in Error"),
}
};
}
macro_rules! apply_option {
($self:expr, $emulation:expr, $(($field:ident, $method:ident)),*) => {
$(
if let Some(value) = $emulation.$field {
$self = $self.$method(value);
}
)*
};
}