1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
pub trait RequestCancellable {
    type Output;

    fn append_request_id(self, request_id: String) -> Self::Output;
}

macro_rules! request_cancellable {
    ($($t:ty), +) => (
        $(impl RequestCancellable for $t {
            type Output = $t;

            fn append_request_id(mut self, request_id: String) -> Self::Output {
                self.arguments.insert("request_id".to_string(), request_id);
                self
            }
        })+
    )
}